I'm new in java, what is the right way to add/pass a value into array string without specifying the array index.

I want to add a value into array like what in php array do.

```
static String[] var_productname = new String[20];

public void setProductName(String productName){
    var_productname[] = productName;

}

```