Question: Write a class MonsterTruck that relates to the Car and Truck classes from Self-Check Problems 9 and 10 and whose methods have the following behavior.
Write a class MonsterTruck that relates to the Car and Truck classes from Self-Check Problems 9 and 10 and whose methods have the following behavior. Whenever possible, use inheritance to reuse behavior from the superclasses.
Data from Self Problem 9
Suppose the Truck code from the previous problem changes to the following:

Using the same variables from the previous problem, what is the output from the following statements?
System.out.println(mytruck);
mytruck.m1();
mytruck.m2();
Data from Previous Problem
Consider the following two automobile classes:

Given the following declared variables, what is the output from the following statements?

public class Truck extends Car { public void ml () { System.out.println ("truck 1"); public void m2 () { super.ml () ; } public String toString () { return super.toString () + super.toString (); } }
Step by Step Solution
3.36 Rating (168 Votes )
There are 3 Steps involved in it
public class Monster Truck extends ... View full answer
Get step-by-step solutions from verified subject matter experts
