Question: Add a new class that extends Vehicle. This new class can be anything you want. Add A Tank Write your class to have Crush as

Add a new class that extends Vehicle. This new class can be anything you want. Add A Tank
Write your class to have Crush as one attribute and method
Create an instance of your new class in Main and call one of its methods, as well as the honk method that it inherits.
Using this java code
class Main
{
public static void main(String[] args)
{
// Create a myCar object
Car myCar = new Car();
// Call the honk() method (from the Vehicle class) on the myCar object
myCar.honk();
myCar.drive();
myCar.drive();
myCar.drive();
// Display the value of the brand attribute (from the Vehicle class) and the value of the modelName from the Car class
System.out.println(myCar);
Jetski watercraft = new Jetski();
watercraft.goOnWater();
watercraft.honk();
//These are a no no:
//myCar.goOnWater();
//watercraft.drive();
}
}

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 Programming Questions!