Mcq On Java Interfaces
6. Which of these keywords is used by a class to use an interface defined previously?
Explanation: interface is inherited by a class using implements.
7. Which is the correct way to inherit and implement the interface?
Explanation:Classes always implements an interface. An interface can extends another interface or multiple interfaces. Hence, answer would be A.
8. which of the following is true about methods in an interface in java?
Explanation:In java, an interface contains only abstract method that can be public and it does not have any method implementation.
9.Which of the following is the correct way of implementing an interface salary by class manager?
Explanation: No Explanation.
10.Which of the following is an incorrect statement about packages?
Explanation:All methods and variables are implicitly public if interface is declared public.
Also check :