Q) Integer a =10; Integer b =10; Integer c =a+b; How many Objects will create here ?
Ans : Zero objects would be created.
When the Integer class is loaded, values between -128 to 127 are cached and thus the values would be fetched from cache unless you explicitly declare Integer a =new Integer(10); Q) Where does String literal pool gets created in? Ans) PermGen before Java 7. After Java 7 it is moved to heap.