Reader Close() Example

Closes the stream and releases any system resources associated with it.


Reader class Close() method example. This example shows you how to use Close() method.This method Closes the stream and releases any system resources associated with it.

Here is the code:-




/**
 * @Program that Closes the stream and releases any system resources associated
 *  with it.
 * Close.java 
 * Author:-RoseIndia Team
 * Date:-5-jun-2008
 */
import java.io.*;
public class Close {

    public static void main(String args[]) throws IOException{
        String s = "Roseindia";
        // Creates a new character-stream reader
        StringReader r = new StringReader(s);
        char[] Arr = new char[s.length()];
        //reads the character array
        r.read(Arr);
        System.out.println("The array contains: ");
        System.out.println(Arr);
        // Closes the StringReader.
        r.close();
    }
}

Output of the Program
 The array contains:
Roseindia

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

HOME | COPYRIGHT | CONTACT US