With new operator String create the string in heap and put a copy in string const pool so the result of hashcode is same in below case;
  String s1 = new String("Test");
   String s2 = new String("Test");
   System.out.println(s1.hashCode() + " "+ s2.hashCode() + " " + s1.equals(s2));
But without using new operator its still giving the same hashcode
String s1 = new String("Test");
    String s2 = "Test";
    System.out.println(s1.hashCode() + " "+ s2.hashCode() + " " + s1.equals(s2));
Then what is the differnce between above two notation of string creation although they are referening to same string in string const. pool
 
     
     
     
     
    