View RSS Feed

My Java Tips

  1. Reading an ASCII file (BufferedReader)

    by , 11-10-2011 at 05:14 PM (My Java Tips)
    Normally we give input to Java applications from command prompt or through GUI. But sometimes, when inputs are in bulk, we can use ASCII files for input. Such files must have some agreed upon pattern so Java parser can understand the meaning of the text. There are many ways to read a file but one of the simplest way is to use BufferedReader class which is found in package.

    First prompt the user to enter the file name with path. This can be done using:

    Java Code:
    Java SE