Question: Assume that this chapters Car class is instantiated with a statement like this: Car car = new Car(Mazda, 2018, green); Enhance this Car class by
Assume that this chapter’s Car class is instantiated with a statement like this:
Car car = new Car("Mazda", 2018, "green");
Enhance this Car class by providing an additional method that responds to this subsequent print statement:
System.out.println(car);
With output like this:
Green 2018 Mazda
Step by Step Solution
3.57 Rating (157 Votes )
There are 3 Steps involved in it
To achieve this you need to override the toString method in your Car class in Java By default this m... View full answer
Get step-by-step solutions from verified subject matter experts
