import java.util.*; public class CollectionInterfaceContainsMethodExample { public static void main(String[] args) { Collection collection = new ArrayList(); collection.add(1); collection.add(2); collection.add(3); boolean result1 = collection.contains(1); if(result1==true){ System.out.println("Element 1 exist in the invoking collection"); } else{ System.out.println("Element 1 does not exist in the invoking collection"); } boolean result2 = collection.contains(5); if(result2==true){ System.out.print("Element 5 exist in the invoking collection"); } else{ System.out.print("Element 5 does not exist in the invoking collection"); } } }