Mcq On Java Interfaces

16. What type of methods an interface contain by default?

A. abstract
B. static
C. final
D. private

View Answer


17. What will happen if we provide concrete implementation of method in interface?

A. The concrete class implementing that method need not provide implementation of that method
B. Runtime exception is thrown
C. Compilation failure
D. Method not found exception is thrown

View Answer


18. What happens when a constructor is defined for an interface?

A. Compilation failure
B. Runtime Exception
C. The interface compiles successfully
D. The implementing class will throw exception

View Answer


19. What happens when we access the same variable defined in two interfaces implemented by the same class?

A. Compilation failure
B. Runtime Exception
C. The JVM is not able to identify the correct variable
D. The interfaceName.variableName needs to be defined

View Answer


20. Can “abstract” keyword be used with constructor, Initialization Block, Instance Initialization and Static Initialization Block.

A. True
B. False

View Answer







Also check :


Discussion


* You must be logged in to add comment.