How can I declare dynamic String array in Java - Stack Overflow You want to use a Set or List implementation (e.g. HashSet , TreeSet , etc, or ArrayList , LinkedList , etc..), since Java does not have dynamically sized arrays.