Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Human extends HumanNumber {
- public int age;
- /*
- staticありの人数をカウントするメソッドを作成
- */
- /*
- public static void humanNumber(){
- num++; }
- */
- /*
- public Human(){ num++; }
- */
- /*
- static無し年齢を取得するメソッドを作成
- */
- // インスタンスフィールドのageの要素を戻り値としてインスタンスメソッドを呼ばれたらインスタンス毎の要素を返してやる
- public int age() {
- return this.age;
- }
- }
Add Comment
Please, Sign In to add comment