Java Stringbuilder Example - Java

How to use stringbuilder in java?

Snippet Code


  
Rate this page :
  [ 0 votes]

String builder in java is used to create a modifiable string at specified length. Here, stringbuilder() method creates an empty string with the initial length of 16.

public class HelloWorld{ public static void main(String []args){ StringBuilder sb=new StringBuilder("Hello "); sb.append("Java"); System.out.println(sb); } }

Tags


Ask Questions

Ask Question