Question: Q. Understand the following program in which TeslaCars class implements interface. Compile the following program and correct the error, and also explain the reason why

Q. Understand the following program in which TeslaCars class implements interface. Compile the following program and correct the error, and also explain the reason why this program gives compilation error.

interface CarDrivingModes {

public void accelerationMode();

public void steeringMode();

public void regenerativeBraking();

public void ludicrous();

public void sport();

}

class TeslaCars implements CarDrivingModes {

public void accelerationMode(){

System.out.println("The Acceleration Modes are: chill, sport, ludicrous, ludicrous+");

}

public void steeringMode(){

System.out.println("The steering Modes are: comfort standard and sport");

}

public void regenerativeBraking(){

System.out.println("Standards and low");

}

}

class TeslaCarsDemo {

public static void main(String[] args) {

CarDrivingModes myTeslaCars = new TeslaCars();

myTeslaCars.accelerationMode();

myTeslaCars.steeringMode();

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!