?? throwdemo.java
字號:
public class ThrowDemo{
public static void main(String []args){
int i;
try{
for(i=1;i<10;i++){
System.out.println(i);
if(i==1)throw new NumberFormatException("Throw Exception1");
if(i==2)throw new ArithmeticException("Throw Exception2");
if(i==3)break;
}
}catch(NumberFormatException e){
System.out.println("捕捉到 NumberFormatException");
}catch(ArithmeticException e){
System.out.println("捕捉到 NumberFormatException");
}finally{
System.out.println("finally塊被執行!");
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -