Complete the code to define a constructor with no parameters.
public class Car { String model; int year; public [1]() { model = "Unknown"; year = 0; } }
The constructor name must exactly match the class name, which is Car.
Complete the code to define a constructor with two parameters.
public class Car { String model; int year; public Car(String [1], int y) { model = [1]; year = y; } }
The parameter name should be model to match the assignment inside the constructor.
Fix the error in the constructor name to correctly overload it.
public class Car { String model; int year; public [1](String model) { this.model = model; year = 2020; } }
The constructor name must exactly match the class name Car with correct capitalization.
Fill both blanks to create a constructor that sets model and year.
public class Car { String model; int year; public Car([1] model, [2] year) { this.model = model; this.year = year; } }
The model is a String and year is an int.
Fill all three blanks to create an overloaded constructor with default year.
public class Car { String model; int year; public Car([1] model) { this.model = model; this.year = [2]; } public Car([3] model, int year) { this.model = model; this.year = year; } }
The first constructor takes a String model and sets year to 2023. The second constructor takes a String model and an int year.
