Zoo.java



/** 象のデータの操作の実験のクラス @version 1.1
 *  コンストラクタによってフィールドの値を初期化
 */
public class Zoo {

  /** 処理の開始 */
    public static void main( String[] argv ) {

        Elephant ele1 = new Elephant( "Hanako", 7 );
        Elephant ele2 = new Elephant( "Tarou", 8 );
        Elephant ele3 = new Elephant( "Gonta", 1 );

        System.out.println( "Elephant " + ele1.name +
                     " is " + ele1.age + " years old." );
        System.out.println( "Elephant " + ele2.name +
                     " is " + ele2.age + " years old." );
        System.out.println( "Elephant " + ele3.name +
                     " is " + ele3.age + " years old." );
    }
}