Define a simple interface


Question 1: Define a simple interface named Motorized with one method (maxSpeed) which returns the maximum attainable speed and another method (fuelType) which returns the type of fuel required.

Question 2: Given the interface defined in question 1, if a class named Motorcycle implements this interface, explain why the following code is legal. What happens when the interface reference vehicle invokes the maxSpeed method?

Motorized vehicle = new Motorcycle( );

System.out.print("The max speed is %d\n", vehicle.maxSpeed( ) )

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Define a simple interface
Reference No:- TGS0535834

Expected delivery within 24 Hours