I know this topic has been discussed a lot previously on this forum, but I'm still confused whether to assume the existence of
string pool for exam purposes or not. In most of the mocks they are assuming the existence of pool.
For example:
How many objects are eligible for GC just after the method returns:
public void compute(Object p){
Object a = new Object();
int x=100;
String str= "abc";
}
If we assume string pool, the answer is 1
otherwise answer is 2, since "abc" is a new string object that is created.
Please correct me if I am wrong here