Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

On virtual machines and expected behaviour

Name: Anonymous 2010-05-17 19:44

Ever tried running this on your ENTERPRISE VIRTUAL MACHINE?
Integer a = 1000;
 Integer b = 1000;
 System.out.println("a == b (1000 == 1000): " + (a == b));

 Integer aa = 100;
 Integer bb = 100;
 System.out.println("aa == bb (100 == 100): " + (aa == bb));

Guess what's the output, run it and report back.

Name: Anonymous 2010-05-17 22:26

>>22
Do you want to clarify what you are saying? Auto-unboxing works for all integers a la
public class Boxing {
    public static void main(String[] args) {
        int i = new Integer(Integer.MAX_VALUE);
        System.out.println(i + "");
    }
}

I'd have let auto-unboxing apply to the full range of Integers, and not just the limited -127 to 128
I'm going to assume you aren't saying we should cache every integer?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List