Write code to check if a char array contains a certain char
//package com.book2s; public class Main { public static void main(String[] argv) { char[] chars = new char[] { 'b', 'o', 'o', 'k', '2', 's', '.', 'c', 'o', 'm', 'a', '1', }; char ch = 'a'; System.out.println(contains(chars, ch)); }/*ww w . ja va 2 s. c om*/ private static boolean contains(char[] chars, char ch) { for (char element : chars) { if (element == ch) return true; } return false; } }