the fallowing first example is from jxam or jargon the out put does not include " End processing " why ?
but second example from Khalid and Rolf example gives an out put which includes " Returning from division." which is at the same place as "End processing" of above example ?
first example :-
import java.io.*;
import java.net.*;
public class Base6{
private void
test() {
try {
String a = null;
String b = null;
// Complex processing
if(a==null)
throw new MalformedURLException("test");
if(b ==null)
throw new EOFException("test");
// Complex processing
System.out.println("End of try block");
}
catch (MalformedURLException e) {
System.out.println("Caught MalformedURLException");
return;
}
catch (EOFException e) {
System.out.println("Caught EOFException");
return;
}
System.out.println("End processing");
}
static public void main(String[] a) {
new Base6().test();
}
}
// Select all valid answers
// a) End of try block
//corect ans b) Caught MalformedURLException
// c) Caught EOFException
// d) End processing
// e) None
second example from Khalid and Rolf :-
class DivisionByZeroException extends Exception {
DivisionByZeroException(String msg) { super(msg); }
}
public class DivisionByZero5 {
public void division() {
int num1 = 10;
int num2 = 0;
try { // (1)
if (num2 == 0) throw new DivisionByZeroException("/ by 0"); // (2)
System.out.println(num1 + " / " + num2 + " = " +
(num1 / num2)); // (3)
} catch (DivisionByZeroException e) { // (4)
System.out.println("Dealt with " + e);
} finally { // (5)
System.out.println("Finally done.");
}
System.out.println("Returning from division."); // (6)
}
public static void main(String args[]) {
new DivisionByZero5().division();
System.out.println("Returning from main."); // (7)
}
}