Java StringBuffer length() Example

Java StringBuffer length() method returns the length (character count).

Java StringBuffer length() Example

public class LengthExample {
    public static void main(String[] args) {
        StringBuffer buffer = new StringBuffer("javaguides");
        int length = buffer.length();
       System.out.println(" length of the string '" + buffer + "' is :: " + length);
    }
}
Output:
 length of the string 'javaguides' is :: 10

Reference


Comments