Online Java Compiler By
JavaTpoint.com
import java.util.ArrayList; public class ArrayListClearExample1 { ArrayList
letters = new ArrayList<>(); letters.add("A"); letters.add("B"); letters.add("C"); System.out.println(letters); // [A, B, C] letters .clear() // clear all letters elements System.out.println(letters); // [] }
Output