Multiple choice technology web technology

abstract class vehicle{ abstract public void speed(); } class car extends vehicle{ public static void main (String args[]) { vehicle ob1; ob1=new car(); //1 }}

  1. compiletime error at line 1

  2. forces the class car to be declared as abstract

  3. Runtime Exception

  4. None of the above

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

The abstract class vehicle has an abstract method speed() that must be implemented by concrete subclasses. Class car extends vehicle but doesn't implement speed(), which means car must also be declared abstract. Option B is correct - this forces the car class to be declared abstract.