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
    }

    
    
  • 相关阅读:
    laravel中get方式表单提交后, 地址栏数据重复的问题
    laravel中firstOrCreate的使用
    表单使用clone方法后, 原有select无法生效
    浏览器提示内容编码错误, 不支持此压缩格式
    web端访问文件没有权限的问题
    $(this)在ajax里面不生效的探究
    如何在github上提交pr
    IDEA配置文件的配置文件配置
    quartz定时任务时间设置
    通过 EXPLAIN 分析低效 SQL 的执行计划
  • 原文地址:https://www.cnblogs.com/naimao/p/13346524.html
Copyright © 2011-2022 走看看