标签:false boolean 时间 print out ret void bsp sys
示例代码:
public class Demo3 { public static void main(String[] args) { //创建一个Date类对象 Date date1 = new Date(); System.out.println(date1.toString()); //当前时间 Date date2 = new Date(date1.getTime()-(60*60*24*1000)); System.out.println(date2); //昨天这个时候 //方法 after , before boolean after = date1.after(date2);//date1是否在date2之后 System.out.println(after); //true boolean before = date1.before(date2); //date1是否在date2之前 System.out.println(before); //false //比较 compareTo(); int i = date1.compareTo(date2); System.out.println(i); //1 int i1 = date2.compareTo(date1); System.out.println(i1); //-1 //比较是否相等 equals(); boolean equals = date1.equals(date2); System.out.println(equals); } }
标签:false boolean 时间 print out ret void bsp sys
原文地址:https://www.cnblogs.com/qiudajiang/p/13254032.html