class a
{
public static void main(String[] args)
{
String s1,s2;
s1= new String("amit");
s2= s1.replace('m','r');
System.out.println(s1.equals(s2));
System.out.println(s1==s2);
String s3,s4;
s3= "arit" ;
s4= "arit";
System.out.println(s3.equals(s4));
System.out.println(s3==s4);
System.out.println(s2==s4);
System.out.println(s1);
System.out.println(s2);
}
}
结果:
false
false
true
true
false
amit
arit
|
-
1.png
(24.36 KB, 下载次数: 170)
|