sampada shukla wrote:I have a confusion in below statements:
Hi sampada, and welcome to JavaRanch.
First: When you post code, please be sure to put it in
code tags. I've done it for you this time - see how much better it looks?
why the output is false true.when in both string and Integer comparison we are comparing object reference to the value?
Because clearly the compiler thinks that in the second case, the two objects you're comparing are
the same.
Which makes me think that you have
not copied your code correctly, because there's no way that 2nd comparison should be true based on what I see.
Winston
PS: You will help yourself (and us) no end if you indent your code properly.