글쓴이 :Sung Yi 2000년 2월 08일 06:02:24
In Reply to: [질문]run-time 시에 예외처리하는 방법있나요? posted by 박재형 on 2000년 2월 07일 17:29:26:
I think that you are doing just fine. That is the right way to catch a runtime error. The only program that I see is in the catch block declaration.
It should be
catch(IndexOutOfBoundException yourOwnVar){
}
Or, if you prefer, you can check the strings before processing.
if((temp1=str.indexOf("test")) >= 0 && (temp2=str.indexOf("program")) >= 0){
temp = str.substring(temp1, temp2);
If you wish to continue processing no matter what the outcome is, you can use the finally{} block.