public class Demo{
public static void main(String[] arr){
Integer num1 = 100;
Integer num2 = 100;
Integer num3 = 500;
Integer num4 = 500;
System.out.println(num3==num4);
if(num1==num2){
System.out.println("num1 == num2");
}
else{
System.out.println("num1 != num2");
}
if(num3 == num4){
System.out.println("num3 == num4");
}
else{
System.out.println("num3 != num4");
}
}
}
the o/p:
false
num1 == num2
num3 != num4`
why is the 2nd if statement i.e(num3 == num4) false where both number has the same value 500 please explain