public class ShowCurrentTime
{
public static void main(String[] args)
{
//Obtain the total millseconds since midnight, Jan 1, 1970
long totalMilliseconds=System.currentTimeMillis();
//Obtain the total seconds since midnight, Jan 1, 1970
long totalSeconds=totalMilliseconds /1000;
//Compute the current second in the minute in the hour
long currentSecond=totalSeconds %60;
//Obtain the total minutes
long totalMinutes =totalSeconds /60;
//Compute the current minute in the hour
long currentMinute =totalMinutes %60;
//Obtain the total hours
long currentHour = totalHours % 24;
//Display results
System.out.println("Current time is"+currentHour+":"+currentMinute
+":"+currentSecond+"GMT");
}
}也不知道是错在哪里?编译运行的时候提示 totalHours不能转换成变量 求高人指点
...全文
1233打赏收藏
java的问题
public class ShowCurrentTime { public static void main(String[] args) { //Obtain the total millseconds since midnight, Jan 1, 1970 long totalMilliseconds=System.currentTimeMillis(); //Obtain the total seconds since midnight, Jan 1, 1970 long totalSec