Archive for February, 2009

Does This Seem Strange To Anybody Else?

Wednesday, February 11th, 2009

It’s sort of a basic Java thing, but I think this seems counter-intuitive:

public class SomeClass {
 
    class InnerClass {
        private int privateInt = 0;
    }
 
    public void someMethod() {
        InnerClass innerClass = new InnerClass();  
 
        innerClass.privateInt = 1; // <-- this is legal        
    }
 
}

In the words of Firefly’s Jubal Early… does that seem right to you?