我对编程非常陌生,可以使用一些帮助。我正在学习如何使用StringBuffer类,并编写了一个简单的代码。但是,当我尝试运行该程序时,我不断收到错误消息“找不到符号”。任何建议都会很棒!谢谢!找不到符号 - StringBuffer
public class StringBuffer{
public static void main(String[] args)
{
StringBuffer sbuff = new StringBuffer();
//one attempt to append - error
sbuff.append("Jenna");
//second attempt to append - error
String phrase = new String("Jenna");
sbuff.append(phrase);
//attempts to call upon other methods - errors
System.out.println("Your name backwards is: " + sbuff.reverse());
System.out.println("The length of your name is: " +sbuff.length());
}
}
确切的错误看起来是这样的:对于reverse
和length
cannot find symbol
symbol: method append(java.lang.String)
location: variable sbuff of type StringBuffer
而且类似的错误。