常用自定义异常抛出实现类

来源:互联网 发布:淘宝上有服装批发吗 编辑:程序博客网 时间:2024/06/05 16:31

/* 非法参数 */throw new IllegalArgumentException("name cannot be null");/* 非法状态 */throw new IllegalStateException("this file is already locked and cannot be changed");/* 不支持的操作 */throw new UnsupportedOperationException("can't manpulate the file");


空指针异常: NullPointerException

类找不到: ClassNotFoundException

越界异常: IndexOutOfBoundsException

没有访问权限异常: IllegalAccessException



0 0
原创粉丝点击