Hector,
> This sentence doesn't compiles (javac from Sun JDK 1.3.x):
>
> public void method() {
>     try {
>       int a = 1;
>     }
>     catch (java.sql.SQLException sqle) {}
> }

    Here the compiler will check whether SQLException can be thrown from the
code in the try block. Since, it cannot be thrown... compiler will give
error.

>
> This method compiles ok:
>
> public void method() throws java.sql.SQLException {
>     int a = 1;
> }

    Here the compiler will not check as above. One possible reason is that
if this method is overridden, the code in that method can throw the
SQLException. Due to this, the compiler doesn't check for explicit
declaration in throws clause.

Hope this helps,
Sourabh

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to