下拉列表例子

时间:2019-01-08 04:16:48
【文件属性】:

文件名称:下拉列表例子

文件大小:1KB

文件格式:JAVA

更新时间:2019-01-08 04:16:48

arraylist

import java.util.ArrayList; import java.util.ListIterator; public class ArrayListDemo { public static void main(String args[]) { // create an array list ArrayList al = new ArrayList(3); System.out.println("Initial size of al: " + al.size()); // add elements to the array list al.add("C"); al.add("A"); al.add("E"); al.add("B"); al.add("D"); al.add("F"); al.add(1, "A2"); System.out.println("Contents of al: " + al); System.out.println("Size of al after additions: " + al.size()); // display the array list System.out.println("Contents of al: " + al); // Remove elements from the array list al.remove("F"); al.remove(2); System.out.println("Contents of al: " + al); // System.out.println(al.get(2)); // System.out.println(al.indexOf("E")); ListIterator li = al.listIterator(); while(li.hasNext()) { System.out.println(li.next()); } al.clear(); System.out.println(al); } }


网友评论