StringBuilder: capacity() : StringBuilder « java.lang « Java by API






StringBuilder: capacity()

 

public class Main {
  public static void main(String[] a) {
    StringBuilder builder1 = new StringBuilder();
    StringBuilder builder2 = new StringBuilder(0);
    StringBuilder builder3 = new StringBuilder(100);

    System.out.println(builder1.capacity());
    System.out.println(builder2.capacity());
    System.out.println(builder3.capacity());

  }

}
/*
16
0
100
*/

   
  








Related examples in the same category

1.new StringBuilder(String str)
2.new StringBuilder(int capacity)
3.StringBuilder: append(char c)
4.StringBuilder: delete(int start, int end)
5.StringBuilder: insert(int offset, String str)
6.StringBuilder: reverse()
7.StringBuilder: toString()