📌  相关文章
📜  如何在java代码示例中将字符串添加到数组中

📅  最后修改于: 2022-03-11 14:52:33.303000             🧑  作者: Mango

代码示例3
in java, once you declared an array you cannot change its size.
so that adding an element to the array is not possible.
you can declare an arraylist, which is the same as array but its resizable.
meaning that you can add or remove at any time and as much you want.
for example:
ArrayList languages = new ArrayList(); 
languages.add("PHP");
languages.add("JAVA");
languages.add("C#");
ArrayList numbers = new ArrayList(); 
numbers.add(9);
numbers.add(14);
numbers.add(2);