How to get a value from ArrayList in Java?

To get a value from ArrayList in Java, call get method.

Here's how you do it:

java.util.List<String> list = new java.util.ArrayList<>();

list.add("Hello");
list.add("World!");

System.out.println(list.get(0)); // Hello
System.out.println(list.get(1)); // World!