Posts

Showing posts from January 27, 2014

StringBuffer in java

import java.io.*;
class a
{
public static void main(String[] args)
{
StringBuffer s=new StringBuffer();
System.out.println(s.capacity());
System.out.println(s.length());
StringBuffer s1=new StringBuffer(100);
System.out.println(s1.capacity());

StringBuffer s2=new StringBuffer("npgc");
System.out.println(s2);
System.out.println(s2.length());
System.out.println(s2.capacity());
}
}

OUTPUT
16
0
100
npgc
4
20