Which of the following is not a correct statement ?
2016
Which of the following is not a correct statement ?
- A.
Every class containing abstract method must be declared abstract.
- B.
Abstract class can directly be initiated with ‘new’ operator.
- C.
Abstract class can be initiated.
- D.
Abstract class does not contain any definition of implementatio
Attempted by 192 students.
Show answer & explanation
Correct answer: B
Answer: The incorrect statement is "Abstract class can directly be initiated with ‘new’ operator."
Explanation:
Every class containing abstract method must be declared abstract: True. If a class declares any abstract method, the class must be declared abstract (otherwise most compilers will report an error).
Abstract class can directly be initiated with ‘new’ operator: False. You cannot instantiate an abstract class directly using new. You must define a concrete subclass that implements abstract methods and then instantiate that subclass.
Abstract class can be initiated: This statement is ambiguous. An abstract class cannot be instantiated directly, but it can have constructors that run when a concrete subclass is created, so its behavior is available through subclass instances.
Abstract class does not contain any definition of implementatio: Incorrect/poorly worded. Abstract classes can contain concrete (implemented) methods as well as abstract methods; they are not limited to only declarations.
Summary: The tested false statement is the claim that an abstract class can be instantiated directly with new. Remember that abstract classes cannot be directly instantiated; use a concrete subclass instead.
A video solution is available for this question — log in and enroll to watch it.