The reason is obvious, Madan.
You can have a try - finally block whitout any catch involved and
Java Language Specification -14.19 gives this description
TryStatement:
try Block Catches
try Block Catches-opt! Finally
So, as you can see the catch block is optional !
Example:
import java.io.*;
public class ATest{
public static void main(
String arg[]) throws IOException{
try{
FileInputStream f=new FileInputStream("c:\test.txt");
}
finally{
System.out.println("No catch block");
}
}
}
Therefore answer 1.(For each try block there must be at least one catch block defined.) is wrong !
Best regards
[This message has been edited by Salamina Daniel (edited November 07, 2001).]