zoukankan      html  css  js  c++  java
  • 13、Java 异常处理

    1

    退JavaJava

    Javathrow JavaJRE

    2

    Javatrycatchfinallythrowthrows

    3

    IOException
    ArithmeticExecption
    NullPointerException
    ClassCastException
    SQLException
    FileNotFoundException
    NegativeArrayException
    ArrayIndexOutOfBoundsException
    SecturityException
    EOFException
    NumberFormatException
    NoSuchMethodException

    4

    4.1trycatch
    try{

       // 

      }catch(ExceptionName e1){

       //Catch 

    }
    4.2throws

    使throws使throws

    4.3throw

    throwtry

    4.4

    tryfinallyfinallytry使

    使finally

    finally {
       // Code for finally block
    }

    5

    Java Exceptionchecked exceptionRuntimeException

    StringStringThrowableThrowable

    package java.io;

    public class IOException extends Exception {
       static final long serialVersionUID = 7818375828146090155L;

       public IOException() {
    super();
      }

       public IOException(String message) {
    super(message);
      }

       public IOException(String message, Throwable cause) {
           super(message, cause);
      }

       public IOException(Throwable cause) {
           super(cause);
      }
    }

    6

    使

    try {
       // May throw Exception1, Exception2, or Exception3
    }
    catch (Exception1 | Exception2 | Throwable    e) {
       // Handle Exceptions here
    }

    
    
  • 相关阅读:
    莫比乌斯反演套路一--令t=pd--BZOJ2820: YY的GCD
    BZOJ2720: [Violet 5]列队春游
    BZOJ2277: [Poi2011]Strongbox
    莫(meng)比(bi)乌斯反演--BZOJ2301: [HAOI2011]Problem b
    「CodePlus 2017 11 月赛」Yazid 的新生舞会
    「CodePlus 2017 11 月赛」大吉大利,晚上吃鸡!
    用NumGo实现安卓动画
    人生
    用NumGo实现安卓动画
    html5使用canvas绘制n角星
  • 原文地址:https://www.cnblogs.com/naimao/p/13346524.html
Copyright © 2011-2022 走看看