程序运行时发生异常
不知道什么原因运行时候发生异常????建立并等待连接~~~~
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String ind
ex out of range: -6
at java.lang.String.substring(String.java:1768)
at ReadTestFile.<init>(ReadTestFile.java:14)
at ServerThread.<init>(ServerThread.java:16)
at MultiServer.main(MultiServer.java:11)
Press any key to continue...
搜索更多相关的解决方案:
运行
----------------解决方案--------------------------------------------------------
数组下标越界异常
在你的程序ReadTestFile里面第14行
----------------解决方案--------------------------------------------------------
老千永远都不会厌倦回答别人的问题,佩服
----------------解决方案--------------------------------------------------------
哎,好像都没有用到数组,是不是字符串长度不够,应该怎么该啊???
public ReadTestFile() throws IOException{
bufReader=new BufferedReader(new FileReader("test.txt"));//
//
String s=bufReader.readLine();//
int i1=s.indexOf('@');//
int i2=s.indexOf("分钟");//
s=s.substring(i1+1,i2);//at ReadTestFile.<init>(ReadTestFile.java:14)
testTime=Integer.parseInt(s)*60*1000;//
//
s=bufReader.readLine().trim();//
correctAnswer=s.substring(s.indexOf("@"+1));//
}
----------------解决方案--------------------------------------------------------