js中var now = new Date();是获取当前时间的意思
翻译成java就是
Date now = new Date();
等同于js的var now = new Date();
int hour = java.util.Calendar.HOUR;
String greet ="Good" + ( hour > 18 ? " evening." : " day.");
Date now = new Date();
String greeting = "Good" + ((now.getHours()>18)?"evening." : "day.");
System.out.print(greeting);
Date now= new Date();
String greeting = "Good";
if(now.getHours()>18)
{
greating = "Good evening";
}
else
{
greating = "Good day ";
}
Date now = new Date();