标签:ima java color port system ring 字符 nbsp 运行
import java.math.BigDecimal; public class StrCompareTo { public static void main(String[] args) { System.out.println("2019-09-09, 2019-08-08:\t" + "2019-09-09".compareTo("2019-08-08")); System.out.println("2019-08-08, 2019-09-09:\t" + "2019-08-08".compareTo("2019-09-09")); System.out.println("2019-09-09, 2019-09-09:\t" + "2019-09-09".compareTo("2019-09-09")); System.out.println("0, 0:\t" + (new BigDecimal(0)).compareTo(new BigDecimal(0))); System.out.println("10, 0:\t" + (new BigDecimal(10)).compareTo(new BigDecimal(0))); System.out.println("0, 10:\t" + (new BigDecimal(0)).compareTo(new BigDecimal(10))); } }
运行结果
2019-09-09, 2019-08-08: 1
2019-08-08, 2019-09-09: -1
2019-09-09, 2019-09-09: 0
0, 0: 0
10, 0: 1
0, 10: -1
标签:ima java color port system ring 字符 nbsp 运行
原文地址:https://www.cnblogs.com/coffee_cn/p/11491072.html