print all elements of arraylist java code example
Example 1: java get all items from arraylist
for (int i = 0; i < arrlist.size(); i++) {
// Get each item (in this case print each item)
System.out.println(arrlist.get(i));
}
Example 2: print list in java
for(int i=0;i<list.size();i++){
System.out.println(list.get(i));
}
Example 3: displaying an arraylist in java
Arrays.toString(list.toArray())