I am pretty new to programming and could use a little help. I am learning how to use the StringBuffer class and I have written a simple code. However, I keep getting the error message "cannot find symbol" when I try to run the program. Any suggestions would be great! Thanks!
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());
}
}
The exact error looks like this:
cannot find symbol
symbol: method append(java.lang.String)
location: variable sbuff of type StringBuffer
And similar errors for reverse
and length
.