99偷拍视频精品区一区二,口述久久久久久久久久久久,国产精品夫妇激情啪发布,成人永久免费网站在线观看,国产精品高清免费在线,青青草在线观看视频观看,久久久久久国产一区,天天婷婷久久18禁,日韩动漫av在线播放直播

Java如何自定義異常打印非堆棧信息詳解-創(chuàng)新互聯(lián)

前言

創(chuàng)新互聯(lián)專注于企業(yè)成都營銷網站建設、網站重做改版、平橋網站定制設計、自適應品牌網站建設、html5成都商城網站開發(fā)、集團公司官網建設、外貿網站制作、高端網站制作、響應式網頁設計等建站業(yè)務,價格優(yōu)惠性價比高,為平橋等各大城市提供網站開發(fā)制作服務。

在學習Java的過程中,想必大家都一定學習過異常這個篇章,異常的基本特性和使用這里就不再多講了。什么是異常?我不知道大家都是怎么去理解的,我的理解很簡單,那就是不正常的情況,比如我現在是個男的,但是我卻有著女人所獨有的東西,在我看來這尼瑪肯定是種異常,簡直不能忍。想必大家都能夠理解看懂,并正確使用。

但是,光學會基本異常處理和使用不夠的,在工作中出現異常并不可怕,有時候是需要使用異常來驅動業(yè)務的處理,例如: 在使用唯一約束的數據庫的時候,如果插入一條重復的數據,那么可以通過捕獲唯一約束異常DuplicateKeyException來進行處理,這個時候,在server層中就可以向調用層拋出對應的狀態(tài),上層根據對應的狀態(tài)再進行處理,所以有時候異常對業(yè)務來說,是一個驅動方式。

有的捕獲異常之后會將異常進行輸出,不知道細心的同學有沒有注意到一點,輸出的異常是什么東西呢?

下面來看一個常見的異常:

java.lang.ArithmeticException: / by zero
 at greenhouse.ExceptionTest.testException(ExceptionTest.java:16)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
 at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
 at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
 at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
 at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
 at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
 at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
 at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
 at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
 at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
 at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

文章標題:Java如何自定義異常打印非堆棧信息詳解-創(chuàng)新互聯(lián)
分享鏈接:http://www.yijiale78.com/article38/docssp.html

成都網站建設公司_創(chuàng)新互聯(lián),為您提供網頁設計公司Google面包屑導航網站設計營銷型網站建設動態(tài)網站

廣告

聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

綿陽服務器托管