第一个文件time.java
public class Time { private int hour; private int minute; private int second; public Time() {setTime(0,0,0);} public void setTime(int hh,int mm,int ss) { hour=((hh>=0 && hh<24) ? hh : 0); minute=((mm>=0 && mm<60) ? mm :0); second=((ss>=0 && ss<60) ? ss :0); } public String toString() { return (hour + " " + ((minute < 10) ? "0" : " ") + minute + ":" + ((second < 10) ? "0" : " ") + second ); } }
第二个文件mytime.java
import Time; public class MyTime { public static void main(String args[]) { Time time=new Time(); time.setTime(11,22,33); System.out.println("设置时间" + time.toString()); } }
请问这两个文件应该怎么编译才能连到一起,我先编译time.java,在编译mytime.java提示
import.time有错误,刚学java,不知道怎么回事