Java code to read the content of a TEXT FILE

Steps
  1. Select Java form the categories and Java Application  from the projects, click Next.
  2. Set the Project name as  readText  and set the Create Main Class, click Finish.
  3. Under the  project "readText", you can see two files, double click the Source Packages,you can see a package by name "readtext " ,double click it you will find the Java Main Class FileReadText.java.
  4. Right click the   package  by name "readtext " and select New -> Other 
  5. From Categories select Java and from File Types select Java Class, click Next
  6. Set the Class Name as "ReadFile.java" and ensure the package name is  "readtext ".
Now open the ReadText.java, remove the existing and paste the following code :