Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. public abstract class Animal {
  2. public final String name;
  3.  
  4. public Animal(String name){
  5. this.name = name;
  6. }
  7.  
  8. // よく考えたら、全てのアニマルがwalkできるとは限らない。
  9. /*
  10. public void walk(){
  11. System.out.println(name + " walk.");
  12. }
  13. */
  14.  
  15. // アニマル共通の鳴き声は存在しない。
  16. // (アニマルというのは、抽象的なもの定義に過ぎず実態を持たない。)
  17. public abstract void cry();
  18.  
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement