how to add new elements to a String array?
String a ;
An array is a container object that holds a fixed number of values of a single type. The length of an array is established when the array is created. After creation, its length is fixed. You've seen an example of arrays already, in the main method of the "Hello World!" application. This section discusses arrays in greater detail.
So in case of String array once you create is with some length then you can't modify it. Like. But you can add element till its length.
String arr = new String; // 10 is the length of array. arr = "kk"; arr = "pp"; ...
So if your requirement is to add many object its recommended to use List's Like :
List<String> a = new ArrayList<String>(); a.add("kk"); a.add("pp");