Question: Consider the interface definition below: public interface TestInterface { abstract public int firstMethod(int a, int b); public void secondMethod(); int thirdMethod(); } Select the two
Consider the interface definition below:
public interface TestInterface { abstract public int firstMethod(int a, int b); public void secondMethod(); int thirdMethod(); }
Select the two statements below that are correct.
- A class ClassA that implements this interface must have firstMethod, secondMethod and thirdMethod in its public protocol.
- A class ClassA that is to implement this interface must have extends TheInterface in its class header.
- This definition of an interface will not compile because all the methods need to be declared to be abstract and public.
- If ClassSubA is a subclass of ClassA, and ClassA implements TheInterface above, then the programmer must explicitly implement firstMethod, secondMethod, thirdMethod in ClassSubA.
- A class ClassA that is to implement this interface must have implements TheInterface in its class header or in the class header of any of its direct or indirect superclasses.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
