I that know in Java the == operator compares references, not the values pointed to, but if so why this gives equal comparison?:
class MainClass{
public static void main(String[] args) {
Integer x = 2;
Integer y = 2;
if(x==y) System.out.println("Equal");
}
}