BufferedReader read Example

BufferedReader class read example. This example shows you how to use read method.


BufferedReader class read example.public int read() throws IOException Reads a single character.

Here is the code
/*
 * @ # Read.java
 * A class repersenting use to read method 
 * of BufferedReader class in java.io package
 * version 29 May 2008
 * author Rose India 
 */

import java.io.*;

public class Read {

    public static void main(String[] argsthrows Exception {

        // Create a new instance of a BufferedReader object using
        // a StringReader.


        String s = "This is the internal StringReader buffer.";
        StringReader stringReader = new StringReader(s);
        BufferedReader bufReader = new BufferedReader(stringReader);

        // Read from the underlying StringReader.
        char[] arr= new char[s.length()];
        

        // Close the BufferedReader object and the underlying
        // StringReader object.
        stringReader.close();
        bufReader.close();
    }
}

Output
 This is the internal StringReader buffer.

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US