how to check if an arraylist contains a string java code example Example: java arraylist contains string boolean ans = arr.contains("geeks");