StringBuilder constructors. - Java Language Basics

Java examples for Language Basics:StringBuilder

Description

StringBuilder constructors.

Demo Code

public class Main 
{
   public static void main(String[] args)
   {/*from  w ww  .  j av a2 s.  c o m*/
      StringBuilder buffer1 = new StringBuilder();
      StringBuilder buffer2 = new StringBuilder(10);
      StringBuilder buffer3 = new StringBuilder("hello");

      System.out.printf("buffer1 = \"%s\"\n", buffer1);
      System.out.printf("buffer2 = \"%s\"\n", buffer2);
      System.out.printf("buffer3 = \"%s\"\n", buffer3);
   } 
}

Result


Related Tutorials