hello
i'm having a problem in reading a text file line by line with splitting words, counting the number of lines & words and saving the position of each word
i've started with this :
i'm having a problem in reading a text file line by line with splitting words, counting the number of lines & words and saving the position of each word
i've started with this :
Code:
public void readlineandword() throws IOException{
BufferedReader rd = new BufferedReader(new FileReader("t1.txt"));
String line = rd.readLine();
Scanner read = new Scanner(line);
String word1 = read.next();
System.out.println(word1);
String word2 = read.next();
System.out.println(word2);
}
Comment