1import java.util.ArrayList;
2public class ArrayListContainsMethodExample
3{
4 public static void main(String[] args)
5 {
6 ArrayList<String> names = new ArrayList<String>(5);
7 names.add("virat");
8 names.add("dhoni");
9 names.add("rohit");
10 names.add("vijay");
11 names.add("ajay");
12 System.out.println("Names: " + names);
13 System.out.print("Does list contains name dhoni?: ");
14 System.out.println(names.contains("dhoni"));
15 System.out.print("Does list contains name Sudhakar?: ");
16 System.out.println(names.contains("Sudhakar"));
17 }
18}