throw Exception 抛异异常
if(this.aop == null)throw new NullPointerException("aop is null"); if(method == null)throw new NullPointerException("method is null"); if(something==null) throw new NullPointerException(); else return "something"; public Object sell(){ if(checkUser()) Object obj = new Object(); return obj ; }else{ throw new RuntimeException(); } } if (t == null) {throw new NullPointerException("something bad");}if (o == null) throw new NullPointerException(); 算术异常类:ArithmeticExecption空指针异常类:NullPointerException类型强制转换异常:ClassCastException数组负下标异常:NegativeArrayException数组下标越界异常:ArrayIndexOutOfBoundsException违背安全原则异常:SecturityException文件已结束异常:EOFException文件未找到异常:FileNotFoundException字符串转换为数字异常:NumberFormatException操作数据库异常:SQLException输入输出异常:IOException方法未找到异常:NoSuchMethodException