執行時產生 runtime exception  ( unchecked exception ):

  • extends Exception
  • 程式上會有開發者無法預期的錯誤
  • 異常會一路拋出至JVM處理
class selfException extends RuntimeException{
}

應受控制產生  Checked Exception :

  • 此類型錯誤應該被處理(開發者認知會有異常發生)
  • 需用try catch於當下處理
    class selfException extends Exception{
    }

參考資料:https://openhome.cc/Gossip/Java/ThrowableHierarchy.html

arrow
arrow

    咪卡恰比 發表在 痞客邦 留言(0) 人氣()