Guest User

Untitled

a guest
Oct 18th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. public class Human extends HumanNumber {
  2.  
  3. public int age;
  4.  
  5. /*
  6. staticありの人数をカウントするメソッドを作成
  7. */
  8.  
  9. /*
  10. public static void humanNumber(){
  11.  
  12. num++; }
  13. */
  14.  
  15. /*
  16. public Human(){ num++; }
  17. */
  18.  
  19. /*
  20. static無し年齢を取得するメソッドを作成
  21. */
  22. // インスタンスフィールドのageの要素を戻り値としてインスタンスメソッドを呼ばれたらインスタンス毎の要素を返してやる
  23. public int age() {
  24. return this.age;
  25.  
  26. }
  27.  
  28. }
Add Comment
Please, Sign In to add comment