Here are some hints:
- Code the class that is going to represent an inventory item.
- It needs field, getters (and maybe setters) and a constructor
-
The declaration of the array will look like this:
private NameOfYourClass[] inventoryItems
-
The initialization can look like this
= new NameOfYourClass[] { new NameOfYourClass(/* constructor arg list */), new NameOfYourClass(/* constructor arg list */), new NameOfYourClass(/* constructor arg list */) };
If that doesn’t make sense, please go back to your textbook, etc and READ.
9
solved How to load data into array?