CDE
This commit is contained in:
parent
518da4a923
commit
764da6cbbb
6144 changed files with 83610 additions and 11 deletions
13
Task/Exceptions/Java/exceptions-4.java
Normal file
13
Task/Exceptions/Java/exceptions-4.java
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
public void foo() throws UnsupportedDataTypeException{
|
||||
try{
|
||||
throwsNumberFormatException();
|
||||
//the following methods throw exceptions which extend IOException
|
||||
throwsUnsupportedDataTypeException();
|
||||
throwsFileNotFoundException();
|
||||
}catch(FileNotFoundException | NumberFormatException ex){
|
||||
//deal with these two Exceptions without duplicating code
|
||||
}catch(IOException e){
|
||||
//deal with the UnsupportedDataTypeException as well as any other unchecked IOExceptions
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue