I have a question. I don't know this makes any sense but i really need an answer
when i use "==" as
Integer i1 =10;
Integer i2 = 10;
if(i1 == i2) {System.out.println("same object")}
output = same object
However , if i use "=="
String obj1 = new String("xyz");
String obj2 = new String("xyz");
if(obj1 == obj2)
System.out.println("obj1==obj2 is TRUE");
else
System.out.println("obj1==obj2 is FALSE");
output = FALSE
I know that "==" operator looks for the memory location of the object. But what happened in first example; i1 and i2 are not a different objects?