import java.util.*;
class GenericDemo
{
public static void main(String[] args)
{
ArrayList<String> al = new ArrayList<String>();
al.add("java01");
al.add("java002");
al.add("java03");
//al.add(4);
Iterator<String> it = al.iterator();
while (it.hasNext())
{
//Object obj = it.next();
//String s = (String)obj;
String s= it.next();
System.out.println(s.length());
}
}
}
|
|