1~100存入集合中,并移除索引为10的对象

Posted 凌零聆

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了1~100存入集合中,并移除索引为10的对象相关的知识,希望对你有一定的参考价值。

import java.util.ArrayList;

public class Bai {

    public static void main(String[] args) {
    ArrayList<Integer> a=new ArrayList<>();
    for (int i = 0; i < 100; i++) 
    {
        a.add(i,i+1);        
        
    }
    a.remove(10);
    for(int b:a)
    {
        System.out.print(b+" ");
    }
    
    }

}

以上是关于1~100存入集合中,并移除索引为10的对象的主要内容,如果未能解决你的问题,请参考以下文章