Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 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