Showing posts with label bit patterns. Show all posts
Showing posts with label bit patterns. Show all posts

Tuesday, 20 December 2011

What will be the result of compiling and running the following code fragment?

Integer i= new Integer("10");

if (i.toString() == i.toString())

System.out.println("Equal");


else

System.out.println("Not Equal");


Choices:

A. Compiler error
B. Prints "Equal"
C. Prints "Not Equal"
D. None of the above


Correct choice:

  • C


Explanation: