Hello
I have write some code to read a specific word from a text file. The file is located in a specific folder.
In the folder there are multiple files, i want to read first the file that is upload first in the directory.
After I have read file, I want to move it in another directory.
How i can do it ?
This the code that I have write.
package project1;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
public class reuter22 {
public static void main(String[] args) {
String line = "";
int lineNo;
try {
FileReader fr = new FileReader("C://Users/BJ001526/Desktop/folder/Ticket.txt");
BufferedReader br = new BufferedReader(fr);
for (lineNo = 1; lineNo < 24; lineNo++) {
if (lineNo == 23) {
line=br.readLine();
} else
br.readLine();
}
} catch (IOException e) {
e.printStackTrace();
}
System.out.println(line.substring(33, 43) );
}
}