How to read a file in Java using Scanner
This tutorial shows how to read a file in Java using Scanner class. The java.util.Scanner can parse text from a variety of input sources like String, File, InputStream, System.in etc. and can break the input into tokens as per the specified delimiter. By default, it uses whitespace as the delimiter.