オブジェクトの操作を行うまえに、表示のためのメソッドを作っておきます。
1 System.out.println(a);
の代わりに
1 a.show();
と書けるようにするには、つぎのようなshowメソッドを定義すればよい。
1 void show() 2 { 3 System.out.println(this); 4 }