The argument: Human h is the one to be added in the ArrayList.
The way you have it. no matter what the argument is, you will always insert the same values:
Human a = new Adult("Joe",43);
Human b = new Adult("Sue",39);
Human c = new Adult("Tracy",20);
Human d = new Child("Sammy",17);
Human e = new Child("Julie",12);
Human f = new Child("Mona",6);
hm.add(a);hm.add(b);hm.add(c);hm.add(d);
hm.add(e);hm.add(f);
It is the argument that you need to insert. Of course before adding it do whatever checks are necessary.
Reputation Points: 1014
Solved Threads: 446
Nearly a Senior Poster
Offline 3,258 posts
since Dec 2007