⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 withfinally.java

📁 这是孙卫琴在"Java与面向对象编程"一书的源代码。
💻 JAVA
字号:
public class WithFinally {
  public void methodA(int money)throws SpecialException{
      if(--money<=0) throw new SpecialException("Out of money");
      System.out.println("methodA");
  }
  public static void main(String args[]){
     try{
        new WithFinally().methodA(1);  //抛出SpecialException异常
        System.out.println("main");
     }catch(SpecialException e){
        System.out.println("Wrong");
     }finally{
       System.out.println("Finally");
     }
  }
}



/****************************************************
 * 作者:孙卫琴                                     *
 * 来源:<<Java面向对象编程>>                       *
 * 技术支持网址:www.javathinker.org                *
 ***************************************************/

 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -