Online Java Compiler By
JavaTpoint.com
import java.util.ArrayList; public class ArrayListRemoveAllExample2 { ArrayList
letters = new ArrayList<>(); letters.add("A"); letters.add("B"); letters.add("C"); letters.add("D"); System.out.println(letters); // [A, B, C, D] ArrayList
numbers = new ArrayList<>(); numbers.add(1); numbers.add(2); letters.removeAll(numbers); // throw ClassCastException }
Output