exception

hello all!!

just a quick question....

public Inserts()throws ClassNotFoundException{

try{

ConnectDB dbConn = new ConnectDB();

this.connection = dbConn.getConnection();

if(this.connection == null)

throw new ClassNotFoundException();

}catch( !!! SQLException e !!! ){

e.printStackTrace();

}

}

the code above says that

businessLayer/Inserts.java:17: exception java.sql.SQLException is never thrown in body of corresponding try statement

but if i change the SQLException (highlighted with exlamation marks !!!) to just "Exception"

then no error shows up.....

i'm wondering why that is.... since all exceptions are derived from Exception

thanks

v.d.

[762 byte] By [velladecina] at [2007-11-27 10:02:55]
# 1
Exactly but the other way around is not true, so why catch something that is never thrown in the block?Kaj
kajbja at 2007-7-13 0:37:21 > top of Java-index,Java Essentials,New To Java...