I tried this code but its not working
import java.util.*;
class StringBuffer
{
    public static void main(String[] args)
    {
        StringBuffer Name1=new StringBuffer();
        Scanner in=new Scanner(System.in);
        System.out.println("Enter a string: ");
        Name1.append(in.nextLine());
        System.out.println(Name1);
    }
}
If the StringBuffer is per-defined then its works. But it fails to take input from user.
 
     
     
     
     
    