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

+2

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: https://code.sololearn.com/chqjtBJ3EwcV/?ref=app

2/9/2021 8:49:24 PM

Guy Robbins

7 Answers

New Answer

+7

Remove the extra curly brace on lines 35 and 46

+3

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

+3

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.

+2

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

+1

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

+1

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

0

Thank you Vasiliy that solved it.