Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Bird {
- // for most birds this is OK, they fly
- public String getMovement() {
- return "Fly";
- }
- public String getCover() {
- return "Feathers";
- }
- }
- public class Penguin extends Bird {
- // penguins don't fly, so we need to override the parent method in order to create more realistic penguins
- @Override
- public String getMovement() {
- return "Walk";
- }
- //we don't override getCover because penguins do have "Feather"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement