求个懂java的大佬帮我看看这个哪里错了qaq
ClassClock{privateintHour;privateintMinute;privateintSecond;publicClock(){Hour=12;Min...
Class Clock{ private int Hour; private int Minute; private int Second; public Clock(){ Hour=12; Minute=30; Second=0;} public Clock(int aHour,int aMinute,int aSecond){ Hour=aHour; Minute=aMinute; Second=asecond;} public void displayTime(){ System.out.println("The Current time is:"+Hour+":"+Minute+":"+Second);}} public cladd Main{ public static void main(String args){ Clock myclock=new Clock(); Clock yourclock=new Clock(10,20,30); myclock.displayTime(); yourclock.displayTime(); }}这里是个小白什么都不懂...
展开
2个回答
展开全部
四个地方书写错误,小毛病,其他都写对了,主要是不认真!
//这是修改好的,你随便参考下!
class Clock
{
private int Hour;
private int Minute;
private int Second;
public Clock()
{
Hour=12; Minute=30; Second=0;
}
public Clock(int aHour,int aMinute,int aSecond)
{
Hour=aHour;
Minute=aMinute;
Second=aSecond;
}
public void displayTime()
{
System.out.println("The Current time is:"+Hour+":"+Minute+":"+Second);
}
}
public class Main
{
public static void main(String[] args)
{
Clock myclock=new Clock();
Clock yourclock=new Clock(10,20,30);
myclock.displayTime();
yourclock.displayTime();
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询