提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
检查数组是否包含int值
/*时 代 J a v a 公 众 号*/ //package com.nowjava; public class Main { public static void main(String[] argv) throws Exception { Object[] myObj = new String[] { "1", "abc", "level", null, "nowjava.com", "asdf 123" }; int indexNum = 2; System.out.println(anyEqual(myObj, indexNum)); } public static boolean anyEqual(Object[] myObj, int indexNum) { for (int a = 0; a < indexNum; a++) { for (int b = 0; b < indexNum; b++) {//from n o w j a v a . c o m - 时 代 Java