Animal Lovers Interfaces | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

9th Feb 2021, 8:49 PM
Guy Robbins
7 Answers
+ 10
Remove the extra curly brace on lines 35 and 46
9th Feb 2021, 9:44 PM
Solo
Solo - avatar
+ 4
Guy Robbins Is there a reason you used an abstract class for Animal rather than using an interface that extends Player and Swimmer?
10th Feb 2021, 1:10 AM
David Carroll
David Carroll - avatar
+ 2
You won't get to know the error during compilation without "public class Program" here but whatever i guess ? Good luck tho.
9th Feb 2021, 11:55 PM
Abhay
Abhay - avatar
+ 2
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.
10th Feb 2021, 1:17 AM
Guy Robbins
+ 2
Guy Robbins Gotcha... Perhaps they build on the abstract class later. 🤔 I thought it was an arbitrary design choice. 👌
10th Feb 2021, 2:22 AM
David Carroll
David Carroll - avatar
+ 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
26th Feb 2021, 9:35 PM
Serana Zentha
Serana Zentha - avatar
0
Thank you Vasiliy that solved it.
9th Feb 2021, 10:40 PM
Guy Robbins