zoukankan      html  css  js  c++  java
  • 第八周 课堂报告

    public class CatchWho { 
        public static void main(String[] args) { 
            try { 
                    try { 
                        throw new ArrayIndexOutOfBoundsException(); 
                    } 
                    catch(ArrayIndexOutOfBoundsException e) { 
                           System.out.println(  "ArrayIndexOutOfBoundsException" +  "/内层try-catch"); 
                    }
     
                throw new ArithmeticException(); 
            } 
            catch(ArithmeticException e) { 
                System.out.println("发生ArithmeticException"); 
            } 
            catch(ArrayIndexOutOfBoundsException e) { 
               System.out.println(  "ArrayIndexOutOfBoundsException" + "/外层try-catch"); 
            } 
        } 
    }

    动手动脑一:

    动手动脑二:

    public class SystemExitAndFinally {
    
        
        public static void main(String[] args)
        {
            
            try{
    
                
                System.out.println("in main");
                
                throw new Exception("Exception is thrown in main");
    
                        //System.exit(0);
    
            
            }
            
            catch(Exception e)
    
                {
                
                System.out.println(e.getMessage());
                
                System.exit(0);
            
            }
            
            finally
            
            {
                
                System.out.println("in finally");
            
            }
        
        }
    
    
    }

  • 相关阅读:
    Uva11988
    Uva140
    子集生成
    Uva129
    Uva524
    Uva10976
    Uva11059
    Uva725
    HDU4268(贪心+multiset)
    HDU2034(set水题)
  • 原文地址:https://www.cnblogs.com/520520520zl/p/11788346.html
Copyright © 2011-2022 走看看