package zixue.String;
public class StringBuffer {
public static void main(String[] args){
StringBuffer ab = new StringBuffer();
ab.append("This ");
ab.append("book ");
ab.append("is ");
ab.append("mine.");
System.out.println(ab);
ab.setCharAt(5,'B');
System.out.println(ab);
}
}
有错:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The method append(String) is undefined for the type StringBuffer
The method append(String) is undefined for the type StringBuffer
The method append(String) is undefined for the type StringBuffer
The method append(String) is undefined for the type StringBuffer
The method setCharAt(int, char) is undefined for the type StringBuffer
at zixue.String.StringBuffer.main(StringBuffer.java:7)
看不懂啊哥哥们……
帮帮忙啦
------解决方案--------------------
你的类名和保留字StringBuffer冲突了,你把类名换一个,比如换成StringBuffer1就没事了....