try {
int a=40,b=0;
int d=a/b;
}catch(Exception e){
System.out.println("Exception: "+e);
System.exit(1);
} finally {
...