提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
从ArrayList的指定索引中删除一个元素
import java.util.ArrayList; /*NowJava.com - 时 代 Java 提 供*/ public class Main { public static void main(String[] args) { ArrayList arrayList = new ArrayList(); arrayList.add("1"); arrayList.add("2"); arrayList.add("3"); Object obj = arrayList.remove(1); System.out.println(obj + " is removed from ArrayList"); System.out.println("ArrayList contains..."); System.out.println(arrayList); } }