How do I read a text file?

The code shown below is an example how to read a text file. This program will read a file called test.txt and shown its content.

You can also try to use the following example to read a file, How do I read text file content line by line using commons-io?.