Append different type of data to StringBuffer
public class MainClass{
public static void main(String[] args) {
StringBuffer sb = new StringBuffer();
sb.append(true);
sb.append('A');
char[] carray = { 'a', 'b', 'c' };
sb.append(carray);
sb.append(carray, 0, 1);
sb.append(3.5d);
sb.append(2.4f);
sb.append(45);
sb.append(90000l);
sb.append("That's all!");
System.out.println(sb);
}
}
Related examples in the same category