Create StringBuffer object

ConstructorSummary
StringBuffer()Creates a string buffer with no characters in it and an initial capacity of 16 characters.
StringBuffer(CharSequence seq)Creates a string buffer that contains the same characters as the specified CharSequence.
StringBuffer(int capacity)Creates a string buffer with no characters in it and the specified initial capacity.
StringBuffer(String str)Creates a string buffer initialized to the contents of the specified string.

public class Main {
  public static void main(String[] argv) {
    StringBuffer sb = new StringBuffer(20);
    System.out.println(sb.capacity());
  }
}

The output:


20
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.