<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                # Exception和Error java中的異常可分為兩大類:Exception(異常)和Error(錯誤),都繼承了Throwable類 > ?**Exception**是程序正常運行中,可以預料的意外情況,可能并且應該被捕獲,進行相應處理; >**Error**是指在正常情況下,不大可能出現的情況,絕大部分的Error都會導致程序(比如JVM自身)處于非正常的、不可恢復狀態。既然是非正常情況,所以不便于也不需要捕獲,常見的有:OutOfMemoryError、NoClassDefFoundError之類,都是Error的子類; # 可檢查異常和不可檢查異常 ## Exceptoin又分為可檢查異常和不檢查異常 1. ? ?可檢查異常必須顯式地進行捕獲處理,這是**編譯期**檢查的一部分(class.forName反射、讀取文件時,文件不存在時的異常); 2. ? ?不可檢查異常就是**運行時異常**,?類似NullPointerExceptin、ArrayIndexOutOfBoundsException之類,通常是可以編碼避免的邏輯錯誤,具體根據需要來判斷是否需要捕獲,并不會在編譯期強制要求 # 異常的合理處置 1. ? ?合理利用try-catch-finally 塊,throw、throws 關鍵字 2. ? ? 盡量不要捕獲類似 Exception 這樣的通用異常,而是應該捕獲特定異常 3. ? ? 不要生吞(swallow)異常 # 異常的分類 ![](https://imgconvert.csdnimg.cn/aHR0cHM6Ly91cGxvYWQtaW1hZ2VzLmppYW5zaHUuaW8vdXBsb2FkX2ltYWdlcy8xNDQwODgxMy03YjkwYTVhMjgxZGIwM2ZiLnBuZw?x-oss-process=image/format,png)![](data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw== "Click and drag to move")?
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看