Question: Question: What happens when a class in Java implements an interface but does not provide an implementation for all of its methods? A) The program
Question: What happens when a class in Java implements an interface but does not provide an implementation for all of its methods?
A) The program will compile successfully but throw a runtime exception.
B) The class must be declared as abstract if it does not implement all the interface methods.
C) Java automatically provides default implementations for the missing methods.
D) The class will fail to compile because interfaces must be fully implemented.
Step by Step Solution
There are 3 Steps involved in it
The detailed answer for the above question is provided below The correct option is B The class must be declared as abstract if it does not implement all the interface methods Reason In Java when a cla... View full answer
Get step-by-step solutions from verified subject matter experts
