0

how to fix

interface Animal { public void eat(); } Cat implements { public eat() { System.out.println("Cat eats"); } }

18th May 2019, 3:19 AM
misbah bagaskara05
misbah bagaskara05 - avatar
5 Answers
+ 8
it's better to use inheritance than an interface , always think to abstract your code https://code.sololearn.com/cmgdrE2k797U/?ref=app
18th May 2019, 3:47 AM
Why So Serious ?
Why So Serious ? - avatar
0
Cat implements Animal In your Cat class add void to the eat method And in your main method: Cat c = new Cat(); c.eat();
18th May 2019, 4:35 AM
JavaBobbo
JavaBobbo - avatar
0
interface Animal { public void eat(); } class Cat implements Animal { public void eat() { System.out.println("Cat eats"); } }
6th Sep 2020, 10:33 AM
Khadhraoui Raoua
Khadhraoui Raoua - avatar
0
Class, Animal, Void
30th Jun 2022, 8:52 PM
Opanuga Stephen
Opanuga Stephen - avatar