CallByReference 예제
class A{
int x = 10;
}
class Test{
void addInt(int i){
System.out.println(i++);
}
void addA(A a1){
System.out.println(a1.x++);
}
}
public class CallByReferenceTest {
public static void main(String[] args) {
Test t = new Test();
A a2 = new A();
t.addA(a2);
System.out.println(a2.x);
}
}