what is the Difference between
String str=new String(\"Thamilan\");
and
String str=\"Thamilan\";
in java
String t = new String("abc");
statement 1 will create an object on Heap, and additionally places an string literal in the pool having the same value.The reference variable t will refer to the object on the heap.
String t = "abc";However statement 2 will only create an object in string constant pool if the object having same value is not present in the pool and t will refer the object placed in the string constant pool.