CitizenTest2.java



/** 継承関係の確認 */
public class CitizenTest2 {

  /** 最初に呼び出される処理 */
    public static void main( String[] argv ) {

         Address ad = new Address( "097-0013", "北海道", "稚内市", "若葉台" );
         Citizen c = new Citizen( 11111111111L, "うえだ たつお", ad );

         Class cls = c.getClass();
         System.out.println( "クラス名:" + cls.getName() );  

         Class scls = cls.getSuperclass();
         System.out.println( "親クラス名:" + scls.getName() );  

         Class sscls = scls.getSuperclass();
         System.out.println( "親の親クラス名:" + sscls.getName() );  
    }
}