Question: 1. When you call this() inside a constructor, what are you doing? 2. Given the below Car class, update the default constructor so that it

1. When you call this() inside a constructor, what are you doing?

2. Given the below Car class, update the default constructor so that it calls the two argument constructor.

public class Car { private String make; private String model; public Car() { make = "Make unknown"; model = "Model unknown"; } public Car(String make, String model) { this.make = make; this.model = model; } public String getMake() { return make; } public String getModel() { return model; } public void setMake(String make) { this.make = make; } public void setModel(String model) { this.model = model; } public boolean timeForService(int currMileage) { if (currMileage < 10000) { return true; } return false; } @Override public String toString() { return "Make: " + make + " Model: " + model; } }

3. Next, override the equals method for the above Car class using the formula provided in class.

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!