public class Str {
public static void main(String[] args) {
String str = "abcde";
String s = str.substring(str.length());
System.out.println(s);
}
}
The index of character 'e' is 4, but I am trying to get the whole string of length 5. If I execute the code above, why it is not throwing the IndexOutOfBoundsException
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…