Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardJavaString.intern and poolSingle-choice MCQ

What does this print, and what does it reveal about String literals and intern() in the pool?

String s = new String("hi"); System.out.println(s.intern() == "hi");