Can someone explain this to me as I'm relatively new to Java and coming from objective-c background (difference being, pass by reference instead of pass (reference) by value).
Given that Java is pass by value I shouldn't expect to be able to re-assign variables within a different scope and have those changes persist, right? Thats why objectValue is null. String and int are primitives so thats why they work. But, why does Integer work?
Object objectValue = null;
int intValue;
String stringValue = null;
Integer integerValue = null;
if (true) {
objectValue = new Aircraft();
intValue = 1;
stringValue = "is one";
integerValue = new Integer(1);
}
// objectValue == null
// intValue == 1
// stringValue == "is one"
// integerValue == 1