1.用类函数来写时间类
import java.util.Scanner; public class Cjava { public static void main(String[]args) { Time t=new Time(); t.setTime(); t.showTime(); } } class Time{ int hour,minute,sec; void setTime() { Scanner s=new Scanner(System.in); hour=s.nextInt(); minute=s.nextInt(); sec=s.nextInt(); } void showTime() { System.out.println(hour+":"+minute+":"+sec); } }
2.没有问题
3.明天继续写