public class StringBufferStringBuilderExample{ public static void main(String args[]){ StringBuffer stringBuffer=new StringBuffer("hello"); stringBuffer.append(" ").append("world"); System.out.println("StringBuffer result:" + stringBuffer); StringBuilder stringBuilder=new StringBuilder(); stringBuilder.append("is").append("awesome"); System.out.println("StringBuilder result:" + stringBuilder); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter