This is my code.
What's going on with Java BufferedReader
's readline()
read result as null
?
FileReader fr = new FileReader("D:\\db.txt");
BufferedReader br = new BufferedReader(fr);
String str =br.readLine();
This is my code.
What's going on with Java BufferedReader
's readline()
read result as null
?
FileReader fr = new FileReader("D:\\db.txt");
BufferedReader br = new BufferedReader(fr);
String str =br.readLine();
BufferedReader.readLine() returns null if the end of the stream has been reached. In your case the file is empty. If the path to the file would be wrong the constructor of FileReader would throw a FileNotFoundException .
I recommend you to get the actual file location and copy that path, then replace all the \ with /. then paste it to your code.