import java.text.BreakIterator;
import java.util.HashMap;
import java.util.Map;
public class test {
public static void main(String args[]){
String[] ss={"大","小","前","大","小"};
Map
String sop="";
for (int i = 0; i < ss.length; i++) {
String temp=ss[i];
int count=0;
for (int j = 0; j < ss.length; j++) {
String temp2=ss[j];
if(temp==temp2){
count++;
}
map.put(ss[i], count);
}
}
System.out.println(map.toString());
}
}
使用 Map