أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.
public static void main(String []args){ Integer i=new Integer(128); int e=128; if(i==e){ System.out.println("Hello World" ); } else { System.out.println("no problem"); } }
O/P: Hello World
1) We would be able to compile it only if you put this code inside a valid class .
2) As others mentioned, when you run it it will print "Hello World".
3) We may also use i.equals(e) instead of i==e
4) We cannot use e.equals(i) , however we can use e==i
Mr. Shahnawaz, any particular reason for this question/ is the answer "Hello World" is wrong ?
Thanks
Answer: no problem
i.equals(e) should have been used
ofcourse "Hello World" becoz reference ID128 is passed into variable i .
Is it to gain the points only ?
Ofcourse : Hello World
Answer: Hello World