0

Why this shows no output

class Main { public static void main(String[] args) { Animal dog = new Dog(); Animal cat = new Cat(); dog.swim(); cat.swim(); dog.play(); cat.play(); } } interface Swimmer { void swim(); } interface Player { void play(); } //implement the Swimmer and the Player interfaces abstract class Animal implements Swimmer , Player { public abstract void swim(); public abstract void play(); } class Dog extends Animal { //Override the swim() and the play() methods public void swim(){ System.out.println("1"); } public void play(){ System.out.println("2"); } } class Cat extends Animal { //Override the swim() and the play() methods public void swim(){ System.out.println("3"); } public void play(){ System.out.println("4"); } } }

1st Aug 2021, 4:59 AM
Chandan Kumar
2 Respuestas
+ 5
Chandan Kumar Because there is extra closing bracket in Cat class.
1st Aug 2021, 5:16 AM
A͢J
A͢J - avatar
+ 1
Thanks. Now it is working.
1st Aug 2021, 5:23 AM
Chandan Kumar
En tendencia hoy
.
1 Votes
What?
0 Votes
HTML
0 Votes
Web
0 Votes
Quiz duel
0 Votes
FRC Coding?
1 Votes
AI
2 Votes
help
0 Votes
APIs
1 Votes