7장 이것만은알고갑시다 문제 질문합니다!
2011-12-24
|
by rlfcksdud
2035
class AccountList
{
public static void main(String[] args)
{
Account obj1 = new Account("111-111","김영미1",1000);
Account obj2 = new Account("211-111","김영미2",12000);
Account obj3 = new CheckingAccount("311-111","김영미3",1000,"555-555-22-33");
Account obj4 = new Account("411-111","김영미4",10);
printAccountList(obj1);
printAccountList(obj2);
printAccountList(obj3);
printAccountList(obj4);
}
static void printAccountList(Account obj){
System.out.println("계좌 번호 :"+obj.accountNo);
System.out.println("이 름 :"+obj.ownerName);
System.out.println("잔 액 :"+obj.balance);
-->> if(obj instanceof CheckingAccount){
CheckingAccount obj2 = (CheckingAccount) obj;
System.out.println("카드번호 :" +obj2.cardNo);
}
System.out.println("============================");
}
}
=========================================================================
화살표한부분 코드해석좀 부탁드려요 ㅜㅜ 책 을아무리 읽어봐도 뭐가뭔지 .............