Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- Tree
- Stack
- Class
- 코딩테스트
- 자바
- Method
- 코테
- Binary Search
- geometry
- dynamic programming
- database
- bit manipulation
- SQL
- simulation
- array
- sorting
- Data Structure
- implement
- Counting
- Matrix
- java
- 구현
- Number Theory
- Binary Tree
- greedy
- string
- 파이썬
- Math
- hash table
- two pointers
Archives
- Today
- Total
목록Catch (1)
코린이의 소소한 공부노트

멀티 catch 블록은 1. 예외 타입은 다르지만 내용이 같은 catch 블록을 하나로 합친 것으로 (jdk 1.7부터 가능) 2. 코드의 중복 제거를 지원하는 기능이 있다. 3. OR 연산에 쓰이는 기호 |(shift + \)를 이용해 합칠 수 있다. try{ // .. } catch(ExceptionA e){ e.printStackTrace(); } catch(ExceptionB e){ e.printStackTrace(); } // 멀티 catch 블록으로 바꾸면 try{ // .. } catch(ExceptionA | ExceptionB e){ e.printStackTrace(); } 4. 주의사항 1) 멀티 catch 블록에 쓰일 예외 클래스에 부모-자식관계는 사용할 수 없다. try{ // ....
Java
2022. 5. 24. 16:27