为什么结果是代码1,而不是-1。
import java.net.URL;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Test {
public static void main(String[] args){
SimpleDateFormat df = new SimpleDateFormat("EEE, d MMM YYYY HH:mm:ss");
try {
Date thisDate= df.parse("Tue, 29 Dec 2015 22:54:40 +0530");
Date thatDate = df.parse("Wed, 23 Dec 2015 15:41:48 +0530");
int result=thisDate.before(thatDate)?1:-1;
System.out.println(result);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}