Content about Java ERP Solution for Reviews Best ERP Software for sale and Free Software with Java OpenSource for Free Download

Java StringBuffer Example to append a lot of String with StringBuffer

When we need to append String with java String we can using a simple Code in below
String x="test1";
x=x+"test2" ;
With this code have some problem when we adding a lot of String it's not support !! surprise
We have the best solution to append String by using StringBuffer we can append a lot of data laugh
StringBuffer is a Class in paclage java.lang 
 Example Code for using StringBuffer
 //Create instance for StringBuffer  
     StringBuffer stringbuffer =new StringBuffer();  
     //Append String to StringBuffer  
     stringbuffer.append("str1");  
     stringbuffer.append("str2");  
     stringbuffer.append("str3");  
     /*  
     ..  
     .. You can append a lot of data you want  
     ..      
     */  
     //Transform it to String  
     String data=stringbuffer.toString();  
     System.out.println("StringBuffer data :"+data);  
            Out put when Run Program

StringBuffer data :str1str2str3