Online Java Compiler By
JavaTpoint.com
import java.util.ArrayList; public class ArrayListAddExample2{ public static void main(String[] args){ ArrayList
id = new ArrayList<>(); list.add(1); // [1] list.add("student id"); // does not compile } }
Output