intitalise arraylist code example
Example 1: arraylist with values java
ArrayList<String> cities = new ArrayList<>(Arrays.asList("London", "Tokyo", "New York"));
Example 2: java create arraly list
List<String> words = new ArrayList<String>();
ArrayList<String> cities = new ArrayList<>(Arrays.asList("London", "Tokyo", "New York"));
List<String> words = new ArrayList<String>();