public class java9_5 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String ch1=new String("java");
String ch2=new String("java");
String ch3=ch2;
if(ch1.equals(ch2))
System.out.println("ch1 equals ch2");
else
System.out.println("ch1 not equals ch2");
if(ch2.equals(ch3))
System.out.println("ch2 equals ch3");
else
System.out.println("ch2 not equals ch3");
}
}
equals比较两个对象的内容
最新推荐文章于 2022-12-08 15:20:03 发布