您的位置:首页 > 其它

StringIndexOutOfBoundsException

2017-06-06 18:20 323 查看
<span style="font-family:Microsoft YaHei;font-size:14px;">public class StringIndexBoundsExceptionTest {

@Test
public void test(){
String str = "h";
String a = "wfe";
System.out.println(str.substring(1));//抛出异常StringIndexBoundsException
System.out.println(a.substring(1, 1));//正常显示
System.out.println(a.substring(1, 0));//抛出异常StringIndexBoundsException
}

}</span>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐