When we create String in JAVA.
String s = new String("hello");
This s
object is created in a Heap. While
String s = "hello";
which is stored in String pool
.
Similarly for the Integer class,
Integer i = new Integer(10); // Created in Heap.
or
Integer ii = 10; // Where is this created? Why I have never heard of Integer pool?