I want my program to do something when it finds the end of a file (EOF) at the end of the last line of text, and something else when the EOF is at the empty line AFTER that
Why not use
if (line.length()==0) { System.out.println("Found an empty line."); }
Note: this will detect a blank line anywhere in the file, not just at EOF.