package lianxi; public class Clock { int hour,minute,second; Clock(int xiaoshi,int fenzhong, int miao) { hour=xiaoshi; minute=fenzhong; second=miao; } void show() { System.out.println(hour+":"+minute+":"+second); } public static void main(String[] args) { Clock clock1=new Clock(2,30,40); clock1.show(); Clock clock2=new Clock(12,40,13); clock2.show(); Clock clock3=new Clock(21,15,11); clock3.show(); } }
转载于:https://www.cnblogs.com/wenwen123/p/5501403.html