I'm trying to write a program, which reads text from a file that is specified by the user. Now, this program should detect an empty line.
This is what I have unsuccessfully tried:
public static void editFile(String filePath) throws FileNotFoundException, IOException {
    file = new File(filePath);
    if(file.exists()) {
        fileRead = new FileReader(file);
        bufferedReader = new BufferedReader(fileRead);
        String line = bufferedReader.readLine();
        System.out.println(line);
        while(line != null) {
            line = bufferedReader.readLine();
            if(line == "") {
                //line = null;
                System.out.println("a");
            }
            System.out.println(line);
        }
    }
}
To be more clear:
If I'm passing in a text file with for example this text:
test1
test2
test3
test4
it should print 2 a's in the console because of the empty spaces, but it doesn't.
Thank you for your time, I am glad for any suggestion you may have.
 
     
     
     
     
    