Which one of the following class definitions is/are a legal definition of a class that cannot be instantiated?
class Main{ //from w ww . j a v a 2 s .c o m abstract void honk (); // (1) } abstract class Main{ void honk (); // (2) } abstract class Main{ void honk (){}; // (3) } abstract class Main{ abstract void honk (){} // (4) } abstract class Main{ abstract void honk (); // (5) }
Select 2 options
Correct Options are : C E
A class is uninstantiable
if the class is declared abstract.
If a method has been declared as abstract, it cannot provide an implementation.
A method body even if empty and the class containing that method must be declared abstract.
If a method is not declared abstract, it must provide a method body.
If any method in a class is declared abstract, then the whole class must be declared abstract.