Jumat, 21 Oktober 2011

clas StuBuf

public class StuBuf
{
public static void main (String args[])
{
StringBuffer sbuf = new StringBuffer(25);
System.out.println("Isi : " + sbuf.toString());
System.out.println("Kapasitas : " + sbuf.capacity());
System.out.println("Panjang : " + sbuf.length());
sbuf.append("Selamat ");
sbuf.append("Belajar Java");
System.out.println(" ");
System.out.println("Isi : " + sbuf);
System.out.println("Kapasitas : " + sbuf.capacity());
System.out.println("Panjang : " + sbuf.length());
System.out.println(" ");
System.out.println("Isi : " + sbuf.substring(0, 7));
System.out.println("Kapasitas : " + sbuf.capacity());
System.out.println("Panjang : " + sbuf.substring(0, 7).length());
}
}

Tidak ada komentar:

Posting Komentar