Question: The Car class will contain two String variables for a car's make and model. The class also contains a constructor. public class Car { /*
The Car class will contain two String variables for a car's make and model. The class also contains a constructor.
public class Car { /* missing code */ } Which of the following replacements for /* missing code */ is the most appropriate implementation of the class?
-
public String make;
public String model;
public Car(String myMake, String myModel) {
/* implementation not shown */
}
public String make;, , public String model;, , public Car(String myMake, String myModel) {, , /* implementation not shown */, , },
-
public String make;
public String model;
private Car(String myMake, String myModel) {
/* implementation not shown */
}
public String make;, , public String model;, , private Car(String myMake, String myModel) {, , /* implementation not shown */, , },
-
private String make;
private String model;
public Car(String myMake, String myModel) {
/* implementation not shown */
}
private String make;, , private String model;, , public Car(String myMake, String myModel) {, , /* implementation not shown */, , },
-
public String make;
private String model;
private Car(String myMake, String myModel) (
/* implementation not shown */
}
public String make;, , private String model;, , private Car(String myMake, String myModel) (, , /* implementation not shown */, , },
-
private String make;
private String model;
private Car(String myMake, String myModel) {
/* implementation not shown */
}
private String make;, , private String model;, , private Car(String myMake, String myModel) {, , /* implementation not shown */, , },
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
