Oct 12, 2018

[HDGEM] How to read line with Scanner in Java

This code reads the file line by line.
public static void readFileByLine(String fileName) {    try {     File file = new File(fileName);     Scanner scanner = new Scanner(file);     while (scanner.hasNext()) {      System.out.println(;     }     scanner.close();    } catch (FileNotFoundException e) {     e.printStackTrace();    }    }
You can also set a delimiter as a line separator and then perform the same.

Posted By Blogger to HDGEM at 2/11/2017 08:29:00 AM

QuickBooks Self-Employed

Bigger tax refunds. Better organization. Manage your deductions with QuickBooks Self-Employed .