- Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMultyRethrow.java
More file actions
Latest commit
27 lines (22 loc) · 572 Bytes
/
Copy pathMultyRethrow.java
File metadata and controls
27 lines (22 loc) · 572 Bytes
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
importjava.io.IOException;
importjava.sql.SQLException;
publicclassMultyRethrow {
publicstaticvoidmain(String[] args) {
try{
readSomeData();
} catch(IOException | SQLExceptione){
e.printStackTrace();
}
}
staticvoidreadSomeData() throwsIOException, SQLException{
try{
// The code that may generate IOException or SQLException
// goes here
SQLExceptionesql = newSQLException("Table Cust doesn't exist");
throwesql;
} catch(Exceptione){
// rethrow the exception
throwe;
}
}
}