CrazyEngineers
  • radha

    radha

    MemberOct 23, 2014

    Query in below java code

    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".
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Home Channels Search Login Register