【发布时间】:2016-07-28 03:38:36
【问题描述】:
我不知道为什么我不能返回真假。它打印“缺少退货声明”。 我在网上寻找答案,但没有一个能解决我的问题。
public boolean Verification(String SQL) throws IOException{
try{
Statement statementCount=connection.createStatement();
ResultSet results = statementCount.executeQuery(SQL);
String Cont=results.getString("ContadorFecha");
int cont=Integer.parseInt(Cont);
if (cont>=10){
return true;
} else {
return false;
}
}catch(SQLException ex) {
ex.printStackTrace();
System.out.println("Exception in register: " + ex);
}
}
【问题讨论】:
-
您不会在
catch块中返回任何内容。因此,正如错误所说,缺少 return 语句。