reset(): This method is available in the java.io.CharArrayWriter class of Java.
Syntax:
void java.io.CharArrayWriter.reset()
This method resets the buffer so that you can use it again without throwing away the already allocated buffer.
Parameters: NA
Returns: NA
Exceptions: NA
Approach
Java
import java.io.CharArrayWriter;import java.io.IOException;public class CharArrayWriterreset {public static void main(String[] args) throws IOException {CharArrayWriter charArrayWriter = new CharArrayWriter();char cbuf[] = { 'a', 'b', 'c', 'd' };charArrayWriter.write(cbuf);charArrayWriter.reset();System.out.println("Successfully reset");charArrayWriter.close();}}
Output:
Successfully reset
No comments:
Post a Comment