2011年12月31日星期六

第10天第1节: 异常的捕获及处理

===Exception
1. Syntax
try {....
  throw Exception;
}catch(Exception_Type1 e){
...
}catch(Exception_Type2 e){
...
}catch(Exception_Type3 e){
...
}finally{
...
}
2. class Exception
class Throwable ->class Exception ==> program error
class Throwable->class Exception ->class RuntimeException
class Throwable->class Error ==>JVM error
Exception(String s)

3. Throws: don't handle exception in current method
public void div(int i, int j) throws Exception:

5. Exception must be caught except for RuntimeException


没有评论: