R4-1
已知代码:
下面展示一些 内联代码片。
class MyDate{
int year;
int month;
int day;
MyDate(int year,int month,int day){
this.year=year;
this.month=month;
this.day=day;
}
}
public class Main{
public static void main(String args[]){
MyDate md1=new MyDate(2009,2,10);
MyDate md2=new MyDate(2009,2,10);
if(md1==md2)
System.out.println("md1==md2");
else
System.out.println("md1!=md2");
if(md1.equals(md2))
System.out.println("md1 is equla to md2");
else
System.out.println("md1 is not equal to md2");
}
}
运行上述代码,写出其运行结果:
md1!=md2
md1 is not equal to md2



