Multiple choice technology web technology

Which of the following statements about abstract methods/classes in Java are true? 1. An abstract class cannot be instantiated. 2. Constructors cannot be abstract. 3. A subclass of an abstract class must defined the abstract methods. 4. Static methods may be declared abstract.

  1. Line 1, line 2 and line 3 only

  2. b.Line 1 only

  3. c.Line 1 and line 2 only

  4. d.Line 2 only

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Abstract classes cannot be instantiated directly (true). Constructors cannot be abstract (true). Subclasses must implement abstract methods only if they are concrete - abstract subclasses can leave them undefined (false). Static methods cannot be abstract (false).

AI explanation

Statement 1 is true: an abstract class cannot be instantiated directly (only concrete subclasses can be). Statement 2 is true: constructors cannot be declared abstract, since they aren't inherited/overridden methods. Statement 3 is false: a subclass of an abstract class is not required to implement all abstract methods — it can itself be declared abstract, deferring implementation further. Statement 4 is false: 'static' and 'abstract' are mutually exclusive modifiers in Java (a static method has a body and can't be overridden). So only lines 1 and 2 are true.