集合类-list

将1-100之间的索引正整数房子一个list集合中,并将索引位置是10的对象从集合移除。

package com.hanqi.jh;

import java.util.*;

public class Homework0528 {

    public static void main(String[] args) {
        
        ArrayList<Integer> ls=new ArrayList<Integer>();
        
        for(int i=1;i<=100;i++)
        {
            ls.add(i);
        }
        
        ls.remove(10);
        
        
        for(int j : ls)
        {
            System.out.println(j);
        }
        
        
        
        
        
        
        
        

    }

}

运行结果:

原文地址:https://www.cnblogs.com/miss123/p/5537562.html