这是我编写的通过键盘输入的,但是没有实现反转,而是输出了null,大家看看是哪里的问题呀:
import java.io.*;
class A
{
public static void main(String args[])
{
try
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter abc please:");
String str=br.readLine();
StringBuffer str1=null;
str1=str1.append(str);
System.out.println(str1.reverse().toString());
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}}