title: How to add value in array in java
body: <p>I'm new in java, what is the right way to add/pass a value into array string without specifying the array index.</p>
  
  <p>I want to add a value into array like what in php array do.</p>
  
  <pre><code>static String[] var_productname = new String[20];
  
  public void setProductName(String productName){
      var_productname[] = productName;
  
  }
  </code></pre>