Complete the code to declare an abstract class named Vehicle.
abstract class [1] { abstract fun start() }
The keyword abstract is used to declare an abstract class. Here, Vehicle is the class name.
Complete the code to declare an abstract method named drive inside an abstract class.
abstract class Vehicle { abstract fun [1]() }
The abstract method drive is declared without a body inside the abstract class.
Fix the error in the subclass that inherits from an abstract class and implements the abstract method.
abstract class Vehicle { abstract fun drive() } class Car : Vehicle() { override fun [1]() { println("Car is driving") } }
The subclass Car must override the abstract method drive from the superclass Vehicle.
Fill both blanks to create an abstract class with an abstract method and a concrete method.
abstract class [1] { abstract fun [2]() fun stop() { println("Stopping") } }
The abstract class is named Machine. It has an abstract method start and a concrete method stop.
Fill all three blanks to implement an abstract class and override its abstract method in a subclass.
abstract class [1] { abstract fun [2]() } class [3] : [1]() { override fun [2]() { println("Running") } }
The abstract class is Runner with an abstract method run. The subclass Athlete overrides run.