Java 5 introduced Scanner class (java.util.Scanner) that can be used to get a file from file system line by line.

Java Code:
File file = new File("C:\\myFile.txt");
Scanner scanner = new Scanner(file);

while (scanner.hasNext()) 
System.out.println(scanner.nextLine());

scanner.close();