JVM has constant pool of string objects.that's why "Java"=="Java" always evaluates to true. is the same case with wrapper objects? Integer i=3; Integer j=3; i==j ?
posted 10 years ago
Not for all values.
This is from the Java Language Specification, 5.1.7.
If the value p being boxed is true, false, a byte, a char in the range \u0000 to \u007f, or an int or short number between -128 and 127, then let r1 and r2 be the results of any two boxing conversions of p. It is always the case that r1 == r2.