What's the point of having Integer
, Boolean
etc and call them "...boxing" if they don't behave like boxed objects that you can pass "by ref" and do unboxing to change their value?
Here's an example of "unboxing" that I actually found out isn't really unboxing.
public static void main(String[] args) {
Boolean x = true;
foo(x);
System.out.println(x);
Integer num = 9;
bar(num);
System.out.println(num);
}
private static void bar(Integer num) {
num = 5;
}
static void foo(Boolean x){
boolean y = false;
x = y;
}
it prints true and 9 btw.