Online Java Compiler By
JavaTpoint.com
import java.util.*; public class JavaCollectionAddExample3 { public static void main(String[] args) { //passing string values List
set = new ArrayList
(); //add String values in this collection set.add(12); //passing null element set.add(null); set.add(0); set.add(5); System.out.print("The elements in Collection : "); System.out.println(set); } }
Output