アプリ版:「スタンプのみでお礼する」機能のリリースについて

ほっんとに初歩的な質問で申し訳ないのですが

StringBuffer s1 = new StringBuffer("Java");
StringBuffer s2 = new StringBuffer("HTML");

S1とS2が次のように与えられていて、s1.delete(1,3)という操作をしたときに何故答えが「Ja」になるらしんですが何故そうなるのですか?
1番目と3番目を消したら「Jv」になるのではないんですか?
大学の授業をまったく聞いていなかったのでわかりません。どなたか解説お願いします。

A 回答 (1件)

http://java.sun.com/j2se/1.5.0/docs/api/java/lan …

定義くらいはきちんと読もう

>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.

indexが1から(3-1)=2までだから

Java
0123

Ja
03

だろう
    • good
    • 0
この回答へのお礼

なるほど!!分かりました。どうもすみません

お礼日時:2007/08/01 15:03

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!