MCPcopy Create free account
hub / github.com/DuGuQiuBai/Java / ArrayListDemo

Class ArrayListDemo

day16/code/day16_Generic/src/cn/itcast_01/ArrayListDemo.java:21–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19 * �ڶ��������ʱ���Ҿ���ȷ��������Ԫ�ص����ͣ������Ժ������ӵ�ʱ�򣬾Ͳ�������κ����⡣
20 */
21public class ArrayListDemo {
22 public static void main(String[] args) {
23 // �洢�ַ���������
24 ArrayList array = new ArrayList();
25
26 array.add("hello");
27 array.add("world");
28 array.add("java");
29 // array.add(new Integer(100));
30 // array.add(100); // �Զ�װ��
31
32 Iterator it = array.iterator();
33 while (it.hasNext()) {
34 String s = (String) it.next();
35 System.out.println(s);
36 // Object obj = it.next();
37 // // if (obj instanceof String) {
38 // // String s = (String) obj;
39 // // System.out.println(s);
40 // // } else if (obj instanceof Integer) {
41 // // Integer i = (Integer) obj;
42 // // System.out.println(i);
43 // // }
44 // System.out.println(obj);
45 }
46
47// String[] strArray = new String[3];
48// strArray[0] = "hello";
49// strArray[1] = "world";
50// strArray[2] = 100;
51 }
52}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected