public ResultSet getParticularEmpoyee(int empId){
PreparedStatement getParticular;
ResultSet result;
try{
getParticular= conn.prepareStatement("SELECT * FROM "+DatabaseHelper.TABLE_NAME+" WHERE EMP_ID = ? ");
getParticular.setInt(1,empId);
result = getParticular.executeQuery();
// return result;
}catch(SQLException e){
JOptionPane.showMessageDialog(null, e);
}
return result; // this gives the warning that result may not be initialized :)
}
以上是我出于某种目的的代码,我遇到了问题,我不明白为什么会发生:)这个警告会不会有一些严重的后果,因为它只是一个警告?如果这是一个问题,那么请告诉我避免这种情况的方法!如果我将返回语句放在try块中,则错误会出现“返回语句在最后一个大括号之前丢失”
慕桂英4014372
ibeautiful
烙印99
慕的地10843
相关分类