Complete the code to declare an interface named 'Drivable'.
interface [1] {
fun drive()
}The interface name should be 'Drivable' as declared.
Complete the code to implement the 'Drivable' interface in the 'Car' class.
class Car : [1] { override fun drive() { println("Driving the car") } }
The 'Car' class implements the 'Drivable' interface, so it must use 'Drivable' after the colon.
Fix the error in the code by completing the interface method declaration correctly.
interface Drivable {
fun [1]()
}The method name in the interface should be 'drive' to match the implementation.
Fill both blanks to declare an interface and implement it in a class.
interface [1] { fun start() } class Motorcycle : [2] { override fun start() { println("Motorcycle started") } }
The interface name is 'Startable' and the class 'Motorcycle' implements it.
Fill all three blanks to create an interface with two methods and implement it in a class.
interface [1] { fun start() fun stop() } class Bicycle : [2] { override fun start() { println("Bicycle started") } override fun [3]() { println("Bicycle stopped") } }
The interface is named 'Operable', the class implements it, and the method to override is 'stop'.