本帖最后由 白堇翎 于 2013-7-18 23:42 编辑
那这一行应该改成根据描述 是返回了一个字符串 但是你没有接受
String s1 = s.substring(1);
再打印下s1看就知道了
我直接帮你改下好了 你应该是想要这种效果- class Test {
- public static void main(String[] args) {
- String s = "abc";
- String s1 = s.substring(1);
- s = s.replace("bc", "xyz");
- System.out.println(s);
- System.out.println(s1);
- String value = new String("abc");
- System.out.println(s == value);
- }
- }
复制代码 |