I need help I am working on a program for class. I need to Pass data in a object array from my Main Driver to class in a package but I can get my code to work. I need all the help I can get. From some reason when I loop back thru the array I alwasy get to last thing I load in to the array in any position I look at it the array if that make sence.
This is happening because you made all the member variables in the class BillRecord static. That means that all the objects of that class share the same copies of these variables, so no matter how many you construct, they'll all always have the same set of values: the ones assigned to the last one constructed.
To fix, just make all the members of BillRecord non-static.
Note that static variables are the exception, rather than the norm. Furthermore, functions shouldn't commnicate through static variables as if they were global variables in some other language. In general, make members non-static whenever possible, and also use local variables defined in a method in preference to member variables defined in a class whenever you can.