找不到符号
import java.text.*;public class Time
{
int hours;
int minutes;
int seconds;
Time()
{
hours=00;
minutes=00;
seconds=00;
System.out.println("From the default constructor:"
+"\n Createed a new Time object with data values"
+"\n hours="+hours + "minutes="+minutes + "seconds="+seconds);
}
Time(long hhmmss) //第二个构造方法
{
hours = (int)(hhmmss/10000.0); //抽时
minutes = (int)((hhmmss-hh*10000.0)/100.0);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
seconds = (int)(hhmmss-hh*10000-mm*100.0);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
System.out.println("From the default constructor:"
+"\n Createed a new Time object with data values"
+"\n hours="+hours + "minutes="+minutes + "seconds="+seconds);
}
public void setTime(int hh,int mm,int ss)
{
hours=hh;
minutes=mm;
seconds=ss;
}
public void showTime()
{
DecimalFormat df =new DecimalFormat("0");
System.out.println("The Time is"+df.format(hours%100)+ '/'+df.format(minutes)+'/'+df.format(seconds));
//精确到最后两位
}
public static void main(String[] args)
{
Time a=new Time(); //声明一个Time类型的对象
Time b=new Time(111930);
}
}