i am having trouble with this code.
It does not let me compile in eclipse but there seems to be no error?
Any clue where my mistake lies?
thank you
package useToken;
import java.io.*;
class readFile extends StreamTokenizer {
readFile(InputStream in ){
super(in);
}
public static void main (String argv[]){
try {
int ret;
String string;
BufferedReader in =
new BufferedReader (new InputStreamReader(System.in));
System.out.print("Enter some text: ");
string = in.readLine();
String[] file = {"file1.txt","file2.txt","file3.txt"};
for(int i=0;i<3;i++){
FileInputStream fin = new FileInputStream(file[i]);
readFile rt = new readFile(fin);
int counter =0;
while((ret = rt.nextToken())!= 0 && rt.sval != null){
if(rt.sval.equals(string)){
System.out.println("Found Text :" + rt.sval );
counter++;
}
}
System.out.println("The String Found :" + counter + " " + "times");
System.out.println(file[i] + " " + "Complete");
}
} catch (Exception e ){
System.err.println("Exception :" + e);
}
}
}