public String toString(){ // 메소드 오버라이딩
return "name : "+ name +" money : "+ money+ " iyul : "+iyul;
}
public static void main(String[] arg){
BankSystem a = new BankSystem("A", 1000);
setIyul(0.05f);
System.out.println(a.toString());
BankSystem b = new BankSystem("B", 1500);
setIyul(0.01f);
System.out.println(b.toString());
System.out.println(a.toString()); <-- 처음 할당한 0.05가 출력되지 않고 마지막으로 할당된 0.01 출력
}
}
*결과*
================================
name : A money : 1000 iyul : 0.05
name : B money : 1500 iyul : 0.01
name : A money : 1000 iyul : 0.01