Practical 12: Refine the student manager program to manipulate the student information from files by using the BufferedReader and BufferedWriter

Program:

import java.io.*;
import java.util.*;

class practical12
{
public static void main(String pqr[]) throws Exception
{

        BufferedReader bufRead = new BufferedReader(new FileReader("stdinfo.txt"));
        BufferedWriter bufWrite = new BufferedWriter(new FileWriter("newstdinfo.txt"));
        int i;
        // manipulate the student information from files
        do {
            i = bufRead.read();
            if (i != -1) {
                if (Character.isUpperCase((char) i)) {
                    bufWrite.write(Character.toLowerCase((char) i));
                   
                } else {
                    bufWrite.write((char) i);
                }
            }
        } while (i != -1);
         System.out.println("All the character of stdinfo change to Upaer case: ");
        bufRead.close();
        bufWrite.close();

}
}

Output :

Comments

Popular posts from this blog

Practical 9 : Write an interactive program to print a string entered in a pyramid form. For instance, the string “stream” has to be displayed as follows: