Online Java Compiler By
JavaTpoint.com
import java.util.ArrayList; public class ArrayListRemoveExample3{ public static void main(String[] args){ List
colors = new ArrayList<>(); colors.add("red"); // ["red"] colors.add("blue"); // ["red" , "blue"] colors.remove(0); // return "red" System.out.println(colors.remove(0)); // print "blue" System.out.println(colors); // [] } }
Output