/**
* Title : Demo string buffer append
* Deskripsi: Mendemonstrasikan penggunaan method append pada kelas string buffer
*/
public class DemoSBufferAppend {
/** Main method */
public static void main(String args[])
{
Object obj = "Belajar";
String str = "Pemrograman Java";
char charArray[] = {'a','b','c','d','e','f'};
boolean b = false;
char cd = 'M';
byte bt = 25;
short s = 1000;
int i = 9500;
long l = 250000000;
float f = 23.8f;
double d = 74.982;
StringBuffer buf = new StringBuffer();
buf.append(obj);
buf.append("\n");
buf.append(str);
buf.append("\n");
buf.append(charArray);
buf.append("\n");
buf.append(charArray,0,3);
buf.append("\n");
buf.append(b);
buf.append("\n");
buf.append(cd);
buf.append("\n");
buf.append(bt);
buf.append("\n");
buf.append(s);
buf.append("\n");
buf.append(i);
buf.append("\n");
buf.append(l);
buf.append("\n");
buf.append(f);
buf.append("\n");
buf.append(d);
System.out.println("\nPROGRAM DEMO STRING BUFFER APPEND");
System.out.println("-----------------------------------\n");
System.out.println("Hasil append pada string buffer : \n\n" + buf);
}
}
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment