Wednesday, 9 July 2014

length()

public synchronized int length()
Returns the length (character count) of this string buffer.

public class StringBufferLength {
    public static void main(String args[]){
        StringBuffer str = new StringBuffer("Hi, How are you");
        System.out.println("Length of str is " + str.length());
    }
}

Output
Length of str is 15



Prevoius                                                 Next                                                 Home

No comments:

Post a Comment