Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. public class Bird {
  2.  
  3. // for most birds this is OK, they fly
  4. public String getMovement() {
  5. return "Fly";
  6. }
  7.  
  8. public String getCover() {
  9. return "Feathers";
  10. }
  11.  
  12. }
  13.  
  14.  
  15. public class Penguin extends Bird {
  16.  
  17. // penguins don't fly, so we need to override the parent method in order to create more realistic penguins
  18. @Override
  19. public String getMovement() {
  20. return "Walk";
  21. }
  22. //we don't override getCover because penguins do have "Feather"
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement