Online Java Compiler By
JavaTpoint.com
import java.util.ArrayList; public class ArrayListAddAllExample1 { ArrayList
letters = new ArrayList<>(); letters.add("A"); letters.add("B"); letters.add("C"); System.out.println(letters); // [A, B, C] ArrayList
words = new ArrayList<>(); words.add("Apple"); words.add("Ball"); words.add("Cat"); System.out.println(words); // [Apple, Ball, Cat] System.out.println (letters.addAll(words)); //true System.out.println(letters); // [A, B, C, Apple, Ball, Cat] }
Output