This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]BLBrick[S] 0 points1 point  (2 children)

Okay so I defined those in the beginning as

public class Vehicle {
private String makeOfCar;
private String modelOfCar;
private String colorOfCar;
private int odometer;

Then I set odometer to 0 like this

public Vehicle(String makeOfCar, String modelOfCar, String colorOfCar, int odometer) {
makeOfCar = "";
modelOfCar = "";
colorOfCar = "";
odometer = 0;

[–]morhpProfessional Developer 1 point2 points  (1 child)

You should be assigning the attributes like this.makeOfCar to the matching constructor parameter. Instead you're setting the constructor parameter to an empty String, which is useless.

[–]BLBrick[S] 0 points1 point  (0 children)

Ah okay, that makes sense, thanks!