import java.util.ArrayList;
import java.util.List;
//from 时代Java公众号 - nowjava.com
public class Main {
public static void main(String[] args) {
// Create an ArrayList of String
List<String> nameList = new ArrayList<String>();
// Add some names
nameList.add("A");
nameList.add("B");
nameList.add("C");
// Get the count of names in the list
int count = nameList.size();/*来自 时 代 J a v a - N o w J a v a . c o m*/
// Let us print the name list
System.out.println("List of names...");
for (int i = 0; i < count; i++) {
String name = nameList.get(i);
System.out.println(name);
}
// Let us remove Kathleen from the list
nameList.remove("Kathleen");
// Get the count of names in the list again
count = nameList.size();
/**代码未完, 请加载全部代码(NowJava.com).**/
本文系作者在时代Java发表,未经许可,不得转载。如有侵权,请联系nowjava@qq.com删除。