好的..我是一个完全的 Python 人,很少使用 Java 及其方法。条件是我有一个 Java 函数,我必须向我的导师解释,但我不知道该怎么做……所以如果你们中的一个人能正确阅读,请帮助我分解它并解释它。另外,如果有任何缺陷,我需要找出其操作中的任何缺陷(即循环的使用等)。最后,'string' 和 'string[]' 类型有什么区别?
public static void search(String findfrom, String[] thething){
if(thething.length > 5){
System.err.println("The thing is quite long");
}
else{
int[] rescount = new int[thething.length];
for(int i = 0; i < thething.length; i++){
String[] characs = findfrom.split("[ \"\'\t\n\b\f\r]", 0);
for(int j = 0; j < characs.length; j++){
if(characs[j].compareTo(thething[i]) == 0){
rescount[i]++;
}
}
}
for (int j = 0; j < thething.length; j++) {
System.out.println(thething[j] + ": " + rescount[j]);
}
}
}