Run ❯
Get your
own Java
server
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
import java.util.ArrayList; public class Main { public static void main(String[] args) { ArrayList
cars = new ArrayList
(); cars.add("Volvo"); cars.add("BMW"); cars.add("Ford"); cars.add("Mazda"); ArrayList
brands = new ArrayList
(); brands.add("Microsoft"); brands.add("W3Schools"); brands.add("Apple"); brands.addAll(1, cars); System.out.println(brands); } }
[Microsoft, Volvo, BMW, Ford, Mazda, W3Schools, Apple]