Sunday, 11 June 2017

Java Tutorial : Java IO (CharArrayWriter-append(CharSequence csq) method) ~ foundjava


Click here to watch in Youtube :

CharArrayWriterDemo.java
import java.io.CharArrayWriter;
import java.io.IOException;

/*
 * public CharArrayWriter append(CharSequence csq)
 *
 * Parameters:
 * ----------
 *
 * csq - The character sequence to append. If csq is
 * null, then the four characters "null" are appended to
 * this writer.
 */

public class CharArrayWriterDemo
{

    public static void main(String[] args) throws IOException
    {

        CharArrayWriter charArrayWriter = new CharArrayWriter();
        charArrayWriter.write("Peter is going to India,");

        CharSequence csq = "John is going to Japan.";
        /*
         * Appends the specified character sequence to this
         * writer.
         */
        charArrayWriter.append(csq);
        System.out.println(charArrayWriter.toString());

    }
}
Output
Peter is going to India,John is going to Japan.

Click the below link to download the code:

CLICK HERE

No comments:

Post a Comment