I'm studying Java, so I'll upload it as a memorandum.
【add】 This method is used when adding an element to ArrayList.
Put the value you want to add in the variable name .add () and use it.
ArrayList<String> array = new ArrayList<String>();
array.add ("Japanese"); array.add ("English"); array.add ("French");
The output in the list is as follows.
System.out.println(array);
Japanese, English, French
If you continue to add after this, it will be added as follows.
array.add ("Chinese"); array.add ("German");
System.out.println(array);
Japanese, English, French, Chinese, German
Recommended Posts