Find the error in the logic: Duck should correctly implement the CanMove interface. Fix the error so you get the correct result.
Brain training
- 4
Locked
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
Samuel MichaelExpert
7 March 2021, 03:51
How are interfaces used to hold values i,e CanFly, CanMove animal?
0
Aakankasha Sharma
13 March 2021, 18:20
In the function we are accepting a CanFly/CanMove object. Basically what i understand by looking at it is that it is accepting an object that is implementing the CanFly/CanMove blueprint, so basically a parameter for which we can call the resp doAction/doAnotherAction functions. And yeah we can't create objects from interfaces though, Java would throw that error earlier itself.
0