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