Hmmmm. I was thinking the answer will be B After r = r+1; //Doesn't it return a new object (Stringbuffer.append().toString())?? String r = new String("abc"); and r = r+1; // different 'r' and different hashcode Can some one clarify this for me? Thankx Ragu
Joined: Aug 26, 2000
The question is asking about the reference s. Not r. r = new String("abc"); s = new String("abc"); not the same String object. Not from a pool... like this r = "abc"; s = "abc"; They are the same this way.