CharArrayReader close() in Java

close(): This method is available in the java.io.CharArrayReader class of Java.

Syntax:

void java.io.CharArrayReader.close()

This method closes the stream and releases any system resources associated with it.

Note: Once  the stream has been closed, further read(), ready(),mark(), reset(), or skip() invocations will throw an IOException.

Parameters: NA

Returns: NA

Exceptions: NA

Approach

Java

import java.io.CharArrayReader;

public class CharArrayReaderclose {

    public static void main(String[] args) {
        char buf[] = { 'a', 'b', 'c', 'd' };
        CharArrayReader charArrayReader =
new CharArrayReader(buf);

        System.out.println("Closing the char array reader");
        charArrayReader.close();

    }
}

Output:

Closing the char array reader


No comments:

Post a Comment