检查对象数组是否包含对象
//package com.nowjava; /** * n o w j a v a . c o m - 时 代 Java 提 供 **/ public class Main { public static void main(String[] argv) throws Exception { Object[] array = new String[] { "1", "abc", "level", null, "nowjava.com", "asdf 123" }; Object toTest = "nowjava.com"; System.out.println(contains(array, toTest)); } public static boolean contains(Object[] array, Object toTest) { for (Object e : array) {/**from n o w j a v a . c o m