Questão
ID 776756Disciplina: Tecnologia da Informação
Assuntos: Outras Apis (Jdbc, JMS, JTA, Etc.)
Ano: 2017 Banca: DIRENS MARINHA - Diretoria de Ensino da Marinha Órgão: Marinha do Brasil
Considere a seguinte tabela NOTAS e seu conteúdo.
NOTAS | ||
codMatricula | codDisciplina | nota |
1 | 12 | 5,5 |
2 | 21 | 9,0 |
3 | 22 | 10,0 |
4 | 12 | 6,5 |
Statement stmt = null;
String query = "select n.codMatricula, n.nota" +
"from NOTAS n";
try{
stmt = con. c reate Statement();
ResuItSet rs = stmt.executeQuery(query);
float nota = (float)0.0;
while (rs.next()) {
nota += rs.getFloat("nota");
}
System.out.println(nota);
} catch (SQLExceptione) {
e.printStackTrace();
} finally {
if (stmt != nuil) {stmt.close();}
}
Utilizando JDBC, o que o trecho de código Java imprime no console?