java编程:秒表程序,可实现计算秒数,到达一小时的话,程序终止。
2个回答
展开全部
import java.util.Scanner;
public class Test{
public static void main(String[] args){
System.out.print("Enter the number of second:");
Scanner sc = new Scanner(System.in);
int second = sc.nextInt();
for(int i = second;i>0;i--){
System.out.println(i+" seconds remaining");
try{
Thread.sleep(1000);
}catch(Exception e){}
}
System.out.println("Stopped");
}
}
public class Test{
public static void main(String[] args){
System.out.print("Enter the number of second:");
Scanner sc = new Scanner(System.in);
int second = sc.nextInt();
for(int i = second;i>0;i--){
System.out.println(i+" seconds remaining");
try{
Thread.sleep(1000);
}catch(Exception e){}
}
System.out.println("Stopped");
}
}
追问
就这么简单?
就这么简单?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询