本帖最后由 小凡_fly 于 2014-12-5 09:17 编辑
- //第一个:
- class Demo{
- public static void main(String[] args){
- try{
- showExce();
- System.out.println("A");
- }
- catch(Exception e){
- System.out.println("B");
- }
- finally{
- System.out.println("C");
- }
- System.out.println("D");
- }
- public static void showExce()throws Exception{
- throw new Exception();
- }
- }
- ---------------------------------------------
- //第二个
- class Demo{
- public static void func(){
- try{
- throw new Exception();
- System.out.println("A");
- }
- catch(Exception e){
- System.out.println("B");
- }
- }
- public static void main(String[] args){
- try{
- func();
- }
- catch(Exception e){
- System.out.println("C");
- }
- System.out.println("D");
- }
- }
复制代码 |