
返回此 throwable 的 cause;如果 cause 不存在或未知,则返回 null。
String getLocalizedMessage()
创建此 throwable 的本地化描述。
String getMessage()
返回此 throwable 的详细消息字符串。
ResultSet rs = nulltry {
rs=conn.executeQuery(sql)
while(rs.next()){
id=rs.getInt("id")
}
} catch (Exception e) {
e.printStackTrace()
}finally{
rs.close()
conn.close()
}
自己写一个Exception yourException类,有构造方法
new yourExceotion(e){
// 将异常e插入数据库中
}
try{
// 有异常部分
}catch(Exception e ){
throw new yourExceotion(e)
}
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)