1:
public class Myclass
{
int x;
Myclass(int i){x = i;}
public static void main(
String args[])
{
Myclass m1 = new Myclass(100);
Myclass m2 = new Myclass(100);
System.out.println(m1.equals(m2));
}
}
The result is :false .
Why ? I think it should be :true.
2:
public class test{
public static void main(String[] a){
String s1 = "amit";
String s3 = "arit";
String s4 = "arit";
String s2= s1.replace('m','r');
System.out.println(s2 == s3);
System.out.println(s3 == s4);
}
}
The answer is :
false
true
But I think it should be :false false.
Thanks !!