标题: replace 用法的问题,求解答! [打印本页] 作者: zhang214214 时间: 2015-4-29 20:18 标题: replace 用法的问题,求解答! public class Test6 {
public static void main(String[] args) {
String s = "abc";
s.substring(1);
s.replace("bc", "xyz"); //这句提示错误;错误信息如下,求解!!!
System.out.println(s);
String value = new String ("abc");
System.out.println(s == value);
}
}
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files
The method replace(char, char) in the type String is not applicable for the arguments (String, String)