append(CharSequence): This method is available in the java.io.CharArrayWriter class of Java.
Syntax:
CharArrayWriter java.io.CharArrayWriter.append(CharSequence csq)
This method takes one argument. This method appends the specified character sequence to this writer.
Parameters: One parameter is required for this method.
csq: The character sequence to append.
Note: If csq is null, then the four characters "null" are appended to this writer.
Returns: This writer.
Exceptions: NA
Approach
Java
import java.io.CharArrayWriter;import java.io.IOException;public class CharArrayWriterappend2 {public static void main(String[] args) throws IOException {CharArrayWriter charArrayWriter = new CharArrayWriter();char cbuf[] = { 'a', 'b', 'c' };charArrayWriter.write(cbuf);CharSequence csq = "ABCD";charArrayWriter.append(csq);System.out.println(charArrayWriter.toString());charArrayWriter.close();}}
Output:
abcABCD
No comments:
Post a Comment