Complete the code to declare an abstract class named Vehicle.
public [1] class Vehicle { // class body }
The keyword abstract is used to declare an abstract class in Java.
Complete the code to declare an abstract method named startEngine in the Vehicle class.
public abstract class Vehicle { public [1] void startEngine(); }
The abstract keyword is used to declare an abstract method without a body.
Fix the error in the subclass Car that extends Vehicle by correctly overriding the abstract method startEngine.
public class Car extends Vehicle { @Override public void [1] { System.out.println("Engine started"); } }
The method name must include parentheses () to correctly override the abstract method.
Fill both blanks to declare an abstract class Shape with an abstract method draw.
public [1] class Shape { public [2] void draw(); }
The class must be declared abstract and the method abstract without a body.
Fill all three blanks to create a subclass Circle that extends Shape and implements the draw method.
public class Circle extends [1] { @Override public void [2] { System.out.println([3]); } }
The subclass extends the abstract class Shape, overrides the method draw(), and prints a message.