I have a problem using add an object of the class Fish to an arraylist call itemList.
My Code: -
How do I add objects to an arraylist properly?
Firstly you shouldn’t be
you want all the ItemList to have the same name/number
but then creating more than 1 instance of that class would be a waste of
can hold references to objects of type ItemList. If you try to add "name, number" Java doesn't know you mean a ItemList:-)
the objects that is currently being created in the constructor.