ProgramaçãoLinguagens de programação
- (FCC 2016)
Considere o método abaixo parte de uma classe Java de acesso a um banco de dados. public Cliente buscar(int id) { try { a = c.prepareStatement("select * from cliente where id = ? "); a.setInt(1, id); b = a.executeQuery(); if (b.next()) { Cliente cli = new Cliente(); cli.setId(b.getInt("id")); cli.setNome(b.getString("nome")); cli.setRenda(b.getDouble("renda")); return cli; } else { return null; } } catch (SQLException ex) { return null; } }
As variáveis a e b são, respectivamente, dos tipos
A) Statement e ResultSet.
B) PreparedStatement e RecordSet.
C) Statement e DataSet.
D) PreparedStatement e ResultSet.
E) JDBCStatement e ResultList.
Próximo:
EXERCÍCIOS - Exercício 136
Vamos para o Anterior: Exercício 134
Tente Este: Exercício 222
Primeiro: Exercício 1
VOLTAR ao índice: Programação