Question: T/F code worksheet and basic code writing 1, TF (a) Any class that implements an interface must have all the interface s methods. (b) More
1, TF (a) Any class that implements an interface must have all the interface s methods. (b) More than one class can implement the same interface. (c) Object a of class Foo that implements InterfaceA can be instantiated (initialized) by doing the following: InterfaceA a new Foo(); (d) Interfaces can help eliminate redundancy in code. (e) Interfaces never specify constructors Every object is associated with an interface and a class. (g) Different classes that implement the same interface may also have different and additional methods not specified by that interface. (h) Many classes implementing a common interface is an example of polymorphism. 2. Given an Animal interface, three classes (Puppy, Bunny, Kitten), and a main method at the end for using them, answer questions (a) (d public interface Animal public void speak public class Puppy implements Animal public void bark() System. out.println("arf"); public class Bunny public void speak() System. out.println( public class Kitten implements Animalf public void speak system out.println( meoW public void catch Butterfly system. out.println ("Catching butterflies
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
