日期:2014-05-20 浏览次数:20685 次
/** * project_name: Test * package_name: netsource * package_declaration: package netsource; * filename: CompareArray.java * author: yuhaiming * date: 2007-11-15 */ package netsource; public class CompareArray { public static void disposal(){ String[] array = {"a","b","c","d","e"}; char[] chs = {'a','c','f','e'}; int count =0; String curstr = ""; for(int i=0;i<chs.length;i++){ curstr = String.valueOf(chs[i]); for(int j=0;j<array.length;j++){ if(curstr.equals(array[j])) count++; continue; } } System.out.println("相等的有"+count+"个"); } /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub disposal(); } }