Query in below java code

radha gogia

radha gogia

@radha-BTDzli Oct 27, 2024
String a= "/u0041";
String h=new String("A");
System.out.println(a==h);
System.out.println(a.hashCode()==h.hashCode());


Please explain why the second print statement is giving false when in the string pool we have the same string literal "A".

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform