Q值。以下是我的代码,但我不理解输出。我认为输出应该是 11 3 3.14159 11 8 3.14159 但输出与我的预期完全不同。
公共课时间{
private int hour;
private int minute;
private double second;
public Time () {
this. hour = 0;
this.minute = 0;
this.second = 0;
}
public Time ( int hour, int minute, double second ) {
this.hour = hour;
this.minute = minute;
this.second = second;
}
public static void main(String [] args){
// one way to create and initialize a Time object
Time t1 = new Time ();
t1. hour = 11;
t1. minute = 3;
t1. second= 3.14159;
System.out.println(t1);
// another way to do the same thing
Time t2 = new Time ( 11, 8, 3.14159);
System.out.println (t2);
}
}
**实际输出:时间@ 7852e922 时间@ 4e25154f