hi,
when i try to compile the following code i recieve errors in the lines marked with **. The error says that "Statement not reached".
Is it true that i cannot have any line of code in the "if" blocks after the respective exceptions are thrown. i.e. is it true that "throw" should be the last statement of the block.
Please clear this doubt....
Thanks
import java.io.*;
import java.net.*;
class temp48{
public static void main(
String args[]){
try{
String a=null;
String b=null;
if (a==null){
throw new MalformedURLException();
** System.out.println("bypass exception 1");
}
if (b==null){
throw new IOException();
** System.out.println("bypass exception 2");
}
}
catch(MalformedURLException me){
System.out.println("exception 1 caught");
return;
}
catch(IOException ie){
System.out.println("exception 2 caught");
return;
}
finally{
System.out.println("in finally()");
}
System.out.println("out of try block");
}
}
------------------