14.7-1

 1 package jihe;
 2 
 3 import java.util.ArrayList;
 4 
 5 public class Test {
 6     
 7     public static void main(String[] args)
 8     {
 9         //创建ArrayList类的实例
10         ArrayList<String> arr = new ArrayList<>();
11         
12         //添加1-100之间所有正整数到集合中
13         for(int i = 1; i <= 100; i++)
14         {
15             arr.add("" + i);
16         }
17         
18         //移除索引位置为10的对象
19         arr.remove(10);
20         
21         //遍历集合,打印
22         System.out.println("arr集合里的所有元素:");
23         for(String x : arr)
24         {
25             System.out.print(x + "、");
26         }
27         
28     }
29 
30 }
原文地址:https://www.cnblogs.com/dirgo/p/4886341.html