1.String s1 = new String("hello"); 2.String s2 = new String("hello"); 3.System.out.println(s1==s2):
来源:学生作业帮助网 编辑:作业帮 时间:2024/06/17 00:28:42
![1.String s1 = new String(](/uploads/image/z/11288947-67-7.jpg?t=1.String+s1+%3D+new+String%28%22hello%22%29%3B+2.String+s2+%3D+new+String%28%22hello%22%29%3B+3.System.out.println%28s1%3D%3Ds2%29%3A)
x)3.)KW(6TUK-W52Rsr4Jp)1,.I/-+ JiiZ$;f'x9}E3N\db̧/}~}z>y6c=sS
u?0(t>mk}n;Ny
ٜ5/v2=]4ϧ(6K-,tӎ@%Ez6yv Iq
1.String s1 = new String("hello"); 2.String s2 = new String("hello"); 3.System.out.println(s1==s2):
1.String s1 = new String("hello"); 2.String s2 = new String("hello"); 3.System.out.println(s1==s2):
1.String s1 = new String("hello"); 2.String s2 = new String("hello"); 3.System.out.println(s1==s2):
呃,什么问题呢?这几句话输出的结果是:false.s1,s2指向的对象内容相同,但是本身是不同的.如果使用s1.equals(s2),则是true.