About Question enthuware.ocpjp.v11.2.3667 :
Posted: Wed Jul 21, 2021 11:35 am
Hi everyone,
I'm sorry but this explanation doesn't make sense to me. "it has INTEGER and VARCHAR for int and String values respectively" vs second response being wrong despite having exactly VARCHAR described there?
Code: Select all
Incorrect response n1
ps.setNull(3, JDBCType.INTEGER);
ps.setNull(4, JDBCType.STRING);
The second parameter to the setNull method is of type int and it expects the value to be one of the constants defined in java.sql.Types class. Among other constants, [b]it has INTEGER and VARCHAR for int and String values respectively. STRING is not a valid constant in this class[/b]. java.sql.JDBCType also defines the same names (i.e. INTEGER and VARCHAR, among others) but it is an enum.
Incorrect response n2
ps.setNull(3, JDBCType.INTEGER);
ps.setNull(4, [b]JDBCType.VARCHAR[/b]);
[b]This is wrong for the same reason as above[/b].