0_0_20786201_3149.cpp:1:1: error: 'publicclassFindString' does not name a type
publicclassFindString{/***fileName要查找的文本,str要查找的字符串**/publicintfindString(StringfileName,Stringstr){intcount=0;try{intline=0;//记录行数BufferedReaderbr=newBufferedReader(newFileReader(fileName));Stringtmp=br.readLine();while(tmp!=null){line++;intindex=tmp.indexOf(str,0);while(index>=0){count++;System.out.println("在"+line+"行,第"+index+"列,找到字符:"+str);index=tmp.indexOf(str,index+str.length());}tmp=br.readLine();}br.close();}catch(FileNotFoundExceptione){e.printStackTrace();}catch(IOExceptione){e.printStackTrace();}returncount;}}
^
|