 <p>As others have mentioned, you cannot do this. But instead you can use ArrayList (or any other List) and where needed, convert it to simple array, like this:</p> <pre><code>ArrayList&lt;String&gt; arrayList = new ArrayList&lt;&gt;(); String strings[] = (String[])arrayList.toArray(); </code></pre>