Como posso modificar a introducao do parametro na minha String eu acredto que o result set possa receber esse meu parametro
public Modalidade getModalidadebyId(int id) {
String sql = "select * from modalidade where id=?";
try {
PreparedStatement stmt = connection.prepareStatement(sql);
ResultSet rset = stmt.executeQuery();
Modalidade m = null;
while (rset.next()) {
m = new Modalidade(rset.getInt("id"), rset.getString("nome"),
rset.getString("descricao"));
}
rset.close();
stmt.close();
connection.close();
return m;
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
String sql ="select * from modalidade where id="+id;