import java.io.RandomAccessFile; import java.io.*; public class first{ public static void main(String args[]) throws IOException{ String vopros; String rida; int dlina; int kount; if (args.length!=1){ System.out.println("Puudub faili nimi"); System.exit(0); } BufferedReader sisse=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Budem smotret' fail "+args[0]); System.out.println("Vvedite slovo"); vopros=sisse.readLine(); dlina=vopros.length(); RandomAccessFile rf=new RandomAccessFile(args[0], "r"); kount=0; rida=rf.readLine(); while(rida!=null){ int q=rida.indexOf(vopros); if(q>=0){kount=kount+1;} rida=rf.readLine(); } System.out.println("Strok s takim slovom bylo "+kount); } }