public class Application {
public static void main(String[] args) {
Integer a = new Integer(10);
Integer b = new Integer(10);
int x = new Integer(10);
int y = new Integer(10);
int p = 10;
int q = 10;
System.out.println(a == b);
System.out.println(a == x);
System.out.println(x == p);
System.out.println(b == q);
System.out.println(y == q);
System.out.println(x == y);
}
}
The above code produces the output:
false
true
true
true
true
true
- Please explain the process of primitive type getting compared to a reference type using == ?
- how int x = new Integer(10); getting evaluated internally?