StringBuffer str="Hello,friend.";
str.delete(7,6);
str.append("Java");
请问str.delete(7,6),这条语句的功能是什么?
str.append("Java")的功能又是什么?

解决方案 »

  1.   

    delete的用法使用有误,它是用来删除部分字符的
    append是用来添加字符的
    public StringBuffer delete(int start,
                               int end)
    Removes the characters in a substring of this sequence. The substring begins at the specified start and extends to the character at index end - 1 or to the end of the sequence if no such character exists. If start is equal to end, no changes are made.public StringBuffer append(String str)
    Appends the specified string to this character sequence.
      

  2.   

    str.delete(7,6);删除间隔字符
    str.append("Java");追加字符