public String toString() { return year + " " + make + " " + model; } } Here’s the complete class (without a main method – CodeHS usually provides a separate tester file).

// Setter for make public void setMake(String newMake) { make = newMake; } // Setter for model public void setModel(String newModel) { model = newModel; }

// Getter for make public String getMake() { return make; } // Getter for model public String getModel() { return model; }

// Getters public String getMake() { return make; }

public class Car { private String make; private String model; private int year; // Constructor public Car(String make, String model, int year) { this.make = make; this.model = model; this.year = year; }

You have 0 items in you cart. Would you like to checkout now?
0 items
Switch to Mobile Version
Subscribe Newsletter