The text file, just as a test run, I am using has 12 lines. I want the output to be 12. I keep getting 0 as my output. What is going wrong? I have coded thousands of these methods for school and can literally not figure out why this one does not work. Please help, I am losing my sanity to a simple method.
public static int countLines(String inFileName) {
    int numLines = 0;
    try {
        Scanner scFile = new Scanner(inFileName);
        String line = scFile.nextLine();
        while (!(line.equalsIgnoreCase("")) && scFile.hasNext()) {
            numLines++;
            line = scFile.nextLine();
            scFile.next();
        }
        scFile.close();
    } catch (Exception e) {
        System.out.println("Error: " + e);
    }
    return numLines;
}
 
     
     
    