Multiple choice technology programming languages

Read this piece of code carefully if("String".toString() == "String") System.out.println("Equal"); else System.out.println("Not Equal");Answers

    1. the code will compile an print “Equal”.
    1. the code will compile an print “Not Equal”.
    1. the code will cause a compiler error.
  1. None of Above

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Calling toString on a string literal returns the exact same string object reference, and string literals are interned in Java. Therefore, the equality operator == evaluates to true, and the code compiles and prints Equal.