Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package week3;
- public class Day15F {
- public static void main(String[] args) {
- GoldFish callGoldFish = new GoldFish();
- callGoldFish.summary();
- }
- }
- abstract class Animal2 {
- abstract void animalInfo();
- abstract void movement();
- abstract void eat();
- abstract void makeSound();
- void summary() {
- animalInfo();
- movement();
- eat();
- makeSound();
- }
- }
- class GoldFish extends Animal2 {
- @Override
- void animalInfo(){
- System.out.println("Goldfish are a freshwater fish");
- }
- @Override
- void movement() {
- System.out.println("A Goldfish swims");
- }
- @Override
- void eat() {
- System.out.println("It will happily eat anything");
- }
- @Override
- void makeSound() {
- System.out.println("It doesn't make any sounds");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment