사용자 도구

사이트 도구


java:exception

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
다음 판 양쪽 다음 판
java:exception [2014/01/22 13:20]
kwon37xi [Checked Exception]
java:exception [2014/03/13 16:31]
kwon37xi
줄 1: 줄 1:
 ====== Java Exception ====== ====== Java Exception ======
 +  * [[http://www.tutorialspoint.com/java/java_builtin_exceptions.htm|Java - Built-in Exceptions]]
  
 ===== Checked Exception ===== ===== Checked Exception =====
줄 21: 줄 22:
 } }
  
-public final class UncheckedThrow { +ExceptionThrower.spit(new IOException("테스트 Checked 예외"));
-    private UncheckedThrow(){} +
- +
-    public static void throwUnchecked(final Exception ex){ +
-        // Now we use the 'generic' methodNormally the type T is inferred +
-        // from the parameters. However you can specify the type also explicit! +
-        // Now we du just that! We use the RuntimeException as type! +
-        // That means the throwsUnchecked throws an unchecked exception! +
-        // Since the types are erased, no type-information is there to prevent this! +
-        UncheckedThrow.<RuntimeException>throwsUnchecked(ex); +
-    } +
- +
-    /** +
-     * Remember, Generics are erased in Java. So this basically throws an Exception. The real +
-     * Type of T is lost during the compilation +
-     */ +
-    public static <T extends Exception> void throwsUnchecked(Exception toThrowthrows T{ +
-        // Since the type is erased, this cast actually does nothing!!! +
-        // we can throw any exception +
-        throw (TtoThrow; +
-    } +
-}+
 </code> </code>
java/exception.txt · 마지막으로 수정됨: 2021/07/14 12:49 저자 kwon37xi