public class Test {
public Integer num = 1;
public void change(Integer n) {
n = null;
}
public void print() {
System.out.println(num);
}
public static void main(String[] args) {
Test test = new Test();
test.change(test.num);
test.print();
}
}
Why I can not change the value of the object "num" in above code? How to revise it to achieve the operation.