...
Code Block | ||
---|---|---|
| ||
import java.io.FileInputStream; import java.io.FileNotFoundException; class NewException extends Exception { //common exception for abstraction purposes } class ExceptionExample { public static void main(String[] args) throws NewException { try { FileInputStream dis = new FileInputStream("c:\\" + args[0]); } catch(FileNotFoundException fnf) { System.out.println("Error: Operation could not be performed"throw new NewException(); } //sanitized message } } |
...