Java StringBuffer append method
public class Main {
public static void main(String[] args) {
boolean b = true;
StringBuffer sb1 = new StringBuffer();
sb1.append(b);
System.out.println(sb1);
char c = 'Y';
sb1.append(c);
System.out.println(sb1);
char[] c1 = new char[] { 'Y', 'e', 's' };
sb1.append(c1);
System.out.println(sb1);
double d = 1.0;
sb1.append(d);
System.out.println(sb1);
float f = 1.0f;
sb1.append(f);
System.out.println(sb1);
int i = 1;
sb1.append(i);
System.out.println(sb1);
long l = 1;
sb1.append(l);
System.out.println(sb1);
Object obj = new String("Yes");
sb1.append(obj);
System.out.println(sb1);
String str = new String("Yes");
sb1.append(str);
System.out.println(sb1);
}
}
Related examples in the same category