我對編程非常陌生,可以使用一些幫助。我正在學習如何使用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
而且類似的錯誤。