Change the code as follows:
String sql = ("SELECT Count(*) as found FROM std_details WHERE StudentID='"+id+"';");
int rowCount = 0;
try {
rs = stmt.executeQuery(sql);
rs.next();
rowCount = rs.getInt(1);
System.out.println(rowCount);
} catch (SQLException e1) {
e1.printStackTrace();
}
return (rowCount > 0);
}