Java CharArrayWriter size() Example

CharArrayWriter class size() method example. This example shows you how to use size() method.


Syntax is : public int size()
This method returns the current size of the buffer.

Here is the code.
/**
 * @(#) SizeCharArrayWriter.java
 * A class representing use of method size() of CharArrayWriter() class in 
 java.io Package.
 * @Version  03-May-2008
 @author   Rose India Team
 */
import java.io.*;
public class SizeCharArrayWriter {
    public static void main(String[] args){

    String charSequence  = "MAHENDRA SINGH";
        // Create object of CharArrayWriter class.
        CharArrayWriter objCharArrWriter = new CharArrayWriter();

        // append() method call.
        objCharArrWriter.append(charSequence, 014);
        System.out.println("Elements in char buffer is : " + objCharArrWriter);

    // size() method call.
        int size = objCharArrWriter.size();
    System.out.println("Current size of the buffer is : " + size);
    }
}

Output of the program.
Elements in char buffer is : MAHENDRA SINGH
Current size of the buffer is : 14

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

HOME | COPYRIGHT | CONTACT US