Hi all, I found this question in Sreenivas Majji's Mock Exam question number 9. The code is The answer given is false. I checked it by running the answer given is correct. By viewing the question, my instincts led me to the option B(i,e B). Can someone explain how "==" and "equals()" work with Number class and its subclasses. Thanks in advance Sri
posted 13 years ago
When ever a toString() method is called a new String object is created wrapping the value of the byte and returned by the system. So the two string objects are never equal in this case.