/** * @author lautturi.com * Java example: output specific element of array list in java */ import java.util.*; public class Lautturi { public static void main(String[] args) { List<Integer> list = new ArrayList<>(); for(int i= 1;i<10;i++){ list.add(i); } // prints the fourth value of the list: System.out.println(list.get(3)); } }Source:wwtual.wturi.com
output:
4