Multiple catch in Java 7
It's a new flavor of multiple exception hadler catch....
Before Java 7:
Before Java 7:
try {
// Some code here to access any file like reading/writing....
} catch (FileNotFoundException e) {
System.err.println("FileNotFoundException: "
+ e.getMessage());
throw new SampleException(e);
} catch (IOException e) {
System.err.println("Caught IOException: "
+ e.getMessage());
}
Now in java 7:
try {
// Some code here to access any file like reading/writing.... }catch (FileNotFoundException |IOException ex) { logger.log(ex); }
Comments
Post a Comment