Java runtime exception


[ ´ÙÀ½ ±Ûµé ] [ À̾ ±Û¿Ã¸®±â(´äÇϱâ) ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]

±Û¾´ÀÌ :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.



´ÙÀ½ ±Ûµé:



À̾ ±Û¿Ã¸®±â(´äÇϱâ)

À̸§:
E-Mail:
Á¦¸ñ:
³»¿ë:
HTML ÅÂ±× Æ÷ÇÔ ¿©ºÎ: HTML ¹®¼­ÀÏ °æ¿ì üũ
°ü·Ã URL(¼±ÅÃ):
URL Á¦¸ñ(¼±ÅÃ):
°ü·Ã À̹ÌÁö URL:


[ ´ÙÀ½ ±Ûµé ] [ À̾ ±Û¿Ã¸®±â(´äÇϱâ) ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]