← Oracle questions
Reported in a candidate post, Oct 2024

Output of comparing a string literal with new String using ==

Filed under Oracle

What is the output of comparing a string literal with a new String object using ==, and why? Example: String a = "java"; String b = new String("java"); System.out.println(a == b);

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Oracle questions

Collected from public candidate posts and coding forums. Updated Nov 2026.