import java.util.ArrayList; import java.util.List; import java.util.Collection; public class CollectionInterfaceAddMethodExample { public static void main(String[] args) { Collection collection = new ArrayList(); boolean result1 = collection.add("Ankit"); if(result1==true){ System.out.println("First Element added successfully."); } else{ System.out.println("First Element not added successfully."); } boolean result2 = collection.add("Deepak"); if(result2==true){ System.out.println("Second Element added successfully."); } else{ System.out.println("Second Element not added successfully."); } System.out.print("Elements Of the Array List"); System.out.println(collection + "."); } }