I am new to Java and StackOverflow but as i have read some of the answers about equals they stated :
Equals method compares two objects for their identity and if they are
identical it returns TRUE . whereas if you don't override the method Equals
it acts like ==(which returns true if 2 variables refer to the same object).
Integer x = new Integer(4);
Integer y = new Integer(4);
System.out.println(x.equals(y));
System.out.println(x == y);
If the queries above are correct why does this code print TRUE and FALSE since we are not overriding the method equals?