How can I declare dynamic String array in Java

后端 未结 5 957
南方客
南方客 2021-02-01 05:09

I am using String Array declare as zoom z[]=new String[422];. But this array stores value from 0 to 32, so I got null pointer except

5条回答
  •  暖寄归人
    2021-02-01 05:29

    Maybe you are looking for Vector. It's capacity is automatically expanded if needed. It's not the best choice but will do in simple situations. It's worth your time to read up on ArrayList instead.

提交回复
热议问题