Bootstrap

java统计英文单词_Java 统计英文单词 | 学步园

package second;

import java.util.*;

public class OutputWordMess {

public static void main(String[] args) {

Vector allWord,noSameWord;

WordStatistic statistic=new WordStatistic();

statistic.setFileName("hello.txt");

statistic.WordStatistic();

allWord=statistic.getAllWord();

noSameWord=statistic.getNoSameWord();

System.out.println("共有"+allWord.size()+"个英文单词");

System.out.println("有"+noSameWord.size()+"个互不相同英文单词");

System.out.println("按出现的频率排列:");

int count[]=new int[noSameWord.size()];

for(int i=0;i

String s1=noSameWord.elementAt(i);

for(int j=0;j

String s2=allWord.elementAt(j);

if(s1.equals(s2))

count[i]++;

}

}

for(int m=0;m

;