标签:ati list port position java osi void get public
list往指定的下标插入元素
import java.util.*;
public class ListExample{
public static void main(String[] args){
ArrayList<String> al=new ArrayList<String>();
al.add("Amit");
al.add("Vijay");
al.add("Kumar");
al.add(1,"Sachin"); // list往指定的下标插入元素
System.out.println("Element at 2nd position: "+al.get(2));
for(String s:al){
System.out.println(s);
}
}
}
Element at 2nd position: Vijay
Amit
Sachin
Vijay
Kumar
标签:ati list port position java osi void get public
原文地址:https://www.cnblogs.com/hglibin/p/9941991.html