Animal Lovers Interfaces | Sololearn: Learn to code for FREE!


Animal Lovers Interfaces

So I am suppose to implement the Swimmer and Player class and override their methods but I am not getting any output. Can someone help me? The following code is here:

2/9/2021 8:49:24 PM

Guy Robbins

7 Answers

New Answer


Remove the extra curly brace on lines 35 and 46


Guy Robbins Is there a reason you used an abstract class for Animal rather than using an interface that extends Player and Swimmer?


Yes David Carroll this particular code comes from the 48.2 practice in the app. And the problem for this code asks me to use an abstract class for Animal that implements the Swimmer and Player interface. And, have the Dog and Cat class inherit the interface through the Animal class. I assume the purpose was to have me get used to coding in different ways and different scenarios.


Guy Robbins Gotcha... Perhaps they build on the abstract class later. πŸ€” I thought it was an arbitrary design choice. πŸ‘Œ


You won't get to know the error during compilation without "public class Program" here but whatever i guess ? Good luck tho.


David Carroll its part of a list of lessons, it comes after the teachings of abstract, they're trying to build on it so learning can get used to multiple situations that come up programming


Thank you Vasiliy that solved it.