I am going to create a list that I want to add elements to. I have obtained the elements from clients via them completing 3 dialogue boxes indicating their preferences for a new car, and now I want to add these entries to the list.
I have declared my instance variables and here is the constructor for my list:
 public Car(String aMaker, String aModel, int aYearBuilt);
    {
        super();
        this.maker = aMaker;
        this.model = aModel;
        this.year = aYearBuilt;
    }
I have successfully put the return from my first client's dialogue boxes into 3 variables, created thus:
 String inputMaker;
 String inputModel;
 int inputYear; 
(I remembered to use Integer.parseInt to convert the dialogue input string to an int).
Now I want to put the values in a list:
List<Car> newCarDetails = new ArrayList<Car>();
This is where I start to go wrong:
 newCarDetails.add(new Car(inputMaker, inputModel, inputYear));
    return newCarDetails;
Only I have clearly underestimated the task, because it doesn't work. I just get a hashCode back. Any help greatly appreciated.
 
     
     
     
     
    