Question: Write a Java program to show the following. Create an interface called Vehicle. The vehicle interface has 3 methods namely, - Mileage - NumberOfPassengers -

Write a Java program to show the following. Create an interface called Vehicle. The vehicle interface has 3 methods namely, - Mileage - NumberOfPassengers - VehicleName

Create a class called Car which implements Vehicle interface. Write the implementation for the methods Mileage, NumberOfPassengers, VehicleName inside Car class.

Mileage method implementation in Car class has a variable to hold mileage which is of datatype integer.

NumberOfPassengers method implementation in Car class has an integer variable to hold number of passengers travelling in the car.

VehicleName method implementation in Car class has a String variable to hold the Car name.

Create an object for Car class and print the implementation of Mileage, NumberOfPassengers, VehicleName methods.

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!