String name="Eric", Eric should be created in string constant/memory pool and when we say String name = new String("Eric"), Eric should be created on Heap
Both will be allocated in heap...
In first case, when other reference variable refers the same string literal "Eric"... Compiler will make reference variable to refer the existing Eric string literal in literal pool...
In second case, due to "new" keyword, each time new instance is created and so "Eric" literal will be created more if this kind of statements are used more in the code and lead to Heap Overflow...