Complete the code to declare an abstract class named Vehicle.
public [1] class Vehicle {}
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 a method without a body inside an abstract class.
Fix the error in the code by completing the class declaration to make it abstract.
public [1] {
public abstract void startEngine();
}The class must be declared abstract if it contains abstract methods.
Fill both blanks to complete the subclass Car that extends the abstract class Vehicle and implements the startEngine method.
public class Car [1] Vehicle { @Override public void startEngine() [2] }
The subclass uses extends to inherit from the abstract class. The method body is enclosed in {}.
Fill all three blanks to complete the abstract class Shape with an abstract method area, and a concrete method displayArea that prints the area.
public abstract class Shape { public abstract double [1](); public void [2]() { System.out.println("Area: " + [3]()); } }
The abstract method is named area. The concrete method is displayArea which calls area() to get the value.