ArrayList Basics in Java


ArrayList is a resizable array, which can be very handy when working with a variable amount of data.

Source Code

ArrayList cars = new ArrayList();
cars.add("Volvo");
cars.add("BMW");
System.out.println(cars.get(0)); // Access items
cars.set(0, "Opel"); // Change item
cars.remove(0); // Remove item
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments