Studyon Minte9.com
Java SE




Read file




package testexample; import java.io.File; import java.util.Scanner; public class Testexample { public static void main(String[] args) throws Exception { File file = new File("myfile.txt"); Scanner scanner = new Scanner(file); while (scanner.hasNextLine()) { String line = scanner.nextLine(); System.out.println(line); } scanner.close(); } }
 


http://stackoverflow.com/questions/13185727/reading-a-txt-file-using-scanner-class-in-java