I am new in Java so I need little help
I have
String [] scripts = new String [] ("test3","test4","test5");
and I want to add new strings ( string1,string2) to this array ( scripts) for examples
String string1= " test1"
String string2 = "test2"
I want to add the new string not in the init but in later phase
How I can do it ?
You cannot resize an array in java.
Once the size of array is declared, it remains fixed.
Instead you can use
ArrayListthat has dynamic size, meaning you don’t need to worry about its size. If your array list is not big enough to accommodate new values then it will be resized automatically.