Question: I having problem to update the counter (integer value).
this is the definitions of the class:

```
public class Item_Actions 
{
    private final int MAX_ITEMS = 100;
    private Item myItem[];
    private int counter;

    public Item_Actions()
    {
        myItem  = new Item[MAX_ITEMS];
        counter++;      
    }

    //Constructor add item into the menu (Description, type & price of Item)

    public void addItem(Item itm)
    {
        myItem[counter] = itm;
        counter++;
    }.......

```

Now everytime I call the addItem constructor from another class, the counter always stays on zero.
What causing it and how do I save the data inside?

thanks

Answer: 
Just insert the `static` keyword in before declaration of the variable `counter`. That is

```
 private static int counter=0;

```
The counter should be `static` - you want to limit the number of instantiations, so the counter shouldn't be an instance-variable. Instead it should be "global" - i.e. `static`.
Your array should be `static` as well.

Instead of using a counter and an array, you can use an `ArrayList`.

That all said, avoid `static` fields - instead look for the problem in your other code.