Write code to check if an Array Contains a String
//package com.book2s; public class Main { public static void main(String[] argv) { String[] arrayString = new String[] { "1", "abc", "level", null, "book2s.com", "asdf 123" }; String str = "book2s.com"; System.out.println(ArrayContainString(arrayString, str)); }/*from w w w.ja v a2 s. co m*/ public static boolean ArrayContainString(String[] arrayString, String str) { if (arrayString == null || arrayString.length == 0) { return false; } for (int i = 0; i < arrayString.length; i++) { if (arrayString[i].equals(str)) return true; } return false; } }