Hello, Java genius!
Can anyone help please is there a method on a buffereReader while the next on the file exist do when there is no new lines finish. I searched for that but could not find smth. similar do you know how to do that. This is my code I wanted to do like while there is a new line in the file put it in an arrayList when there is no more lines stop.
Ok, I added
but now it shows NullPointerException when I debugged it it does two tmes and then throws Exception I think it is because there is no an increasement like int i =0; i++
The only way that code can throw NPE is if br is null or equations is null. And that can only happen if you didn't initialize them, or if you explicitly set them to null. It will not happen from reaching the end of the file. So either you are making one of those things be null, or the NPE is coming from somewhere else.