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

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!