0
How i can read a file
3 Answers
0
String fileName = yourFile.txt;
File f = new File(fileName);
try {
BufferedReader read = new BufferedReader(new FileReader(fileName));
String line = "";
int lineCounter = 1;
while( (line = read.readLine()) != null) {
System.out.println(lineCounter+"\t "+line);
lineCounter++;
}
read.close();
} catch (IOException e) {
System.out.println("encounter an error while reading ");
}
I can provide code with comments if needed but this is basically boilerplate
0
thank you my friend that's I need â€ïž