SyntaxFix
Write A Post
Hire A Developer
Questions
You can't. A Java array has a fixed length. If you need a resizable array, use a java.util.ArrayList<String>.
java.util.ArrayList<String>
BTW, your code is invalid: you don't initialize the array before using it.