+ 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
7 Antworten
+ 10
Remove the extra curly brace on lines 35 and 46
+ 4
Guy Robbins Is there a reason you used an abstract class for Animal rather than using an interface that extends Player and Swimmer?
+ 2
You won't get to know the error during compilation without "public class Program" here but whatever i guess ? Good luck tho.
+ 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.
+ 2
Guy Robbins Gotcha... Perhaps they build on the abstract class later. 🤔
I thought it was an arbitrary design choice. 👌
+ 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.