The main
method is the wrong place to initialize an item
's array. Here,
item list[]=new item [7];
you have declared a local array that is itself called list
. Instead, initialize the list
instance variable of item
in its constructor or as part of the declaration.
Additionally, I don't see any reason why your class with the main
method, homework3main
, should extend item
. Plus, the naming convention in Java is to name classes starting with an uppercase character, e.g. Item
and Homework3Main
.