标签:null lin pre ann throws regex read port pat
package 统计1; import java.util.Scanner; import java.io.*; import java.util.regex.Matcher; import java.util.regex.Pattern; public class UserNeedManager { public static void main(String[]args)throws IOException{ FileReader in=new FileReader("new.txt"); FileWriter fw=new FileWriter("new1.txt",true); PrintWriter bw=new PrintWriter(fw); char[] buf=new char[999];//创建数组 in.read(buf);//将读到字符输到数组 int mount; for(int i=65;i<=122;i++){ mount=0; for(int j=0;j<buf.length;j++){ if((char)i==buf[j]) { mount++; } } if(mount!=0) { System.out.println((char)i+":"+mount); String[] st={"字母","1","的数目:","a"}; char letter=(char)i; st[1]=String.valueOf(letter); st[3]=String.valueOf(mount); for(int k=0;k<4;k++) bw.println(st[k]); }} bw.close(); BufferedReader br=new BufferedReader(in); PrintWriter bw1=new PrintWriter(fw); String[] s=new String[999]; int length=0; while((s[length]=br.readLine())!=null){ length++; } for(int q=0;1<length;q++){ int mount1=1; for(int p=q;p<length;p++){ if(s[q].equals(s[p])){ mount1++; s[p]="0"; } System.out.println(s[q]+"数目:"+mount1); String[] st1={"单词","1","的数目:","a"}; st1[1]=String.valueOf(s[q]); st1[3]=String.valueOf(mount1); for(int k=0;k<4;k++) bw1.println(st1[k]); bw1.close(); } }
标签:null lin pre ann throws regex read port pat
原文地址:https://www.cnblogs.com/NCLONG/p/9775691.html