/* 
Before method1, acc is :
Name: Charles
Saving: 1000

Aafter method1, acc is :
Name: Charles
Saving: 1000

Before method2, acc is :
Name: Charles
Saving: 1000

Aafter method2, acc is :
Name: Charles
Saving: 2000
*/
public class PassByReferTest {
    public static void main(String[] args) {
        BankAccount acc = new BankAccount("Charles", 1000);
	System.out.println("Before method1, acc is :\n" + acc.showInfo());
	method1(acc);
	System.out.println();
	System.out.println("After method1, acc is :\n" + acc.showInfo());
	System.out.println();
	System.out.println("Before method2, acc is :\n" + acc.showInfo());
	method2(acc);
	System.out.println();
	System.out.println("After method2, acc is :\n" + acc.showInfo());
	
    }
    
    public static void method1(BankAccount a) {
	a = new BankAccount("Amy");
    }
    
    public static void method2(BankAccount a) {
	a.deposit(1000);
    }
}
