View RSS Feed

Recent Blogs Posts

  1. How to use properties file in Java

    by , 02-29-2012 at 10:57 AM
    Software programs may need to store its settings or configuration in a file on disk, such as database connection settings or user preferences. In Java, it is possible to use some classes in the java.io package such as FileReader and FileWriter to read/write the configuration file. However, that approach is tedious and error-prone, because it requires writing a lot of code from scratch. Fortunately, the Java platform provides an out-of-the-box utility class which is designed specifically for that ...
    Categories
    Properties
  2. Reading an ASCII file (BufferedReader)

    by , 11-10-2011 at 06: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 java.io package.


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

    Java Code:
      
    ...
    Categories
    Java SE