could you, please add an explanation why the second option is incorrect:
ps.setNull(3, JDBCType.INTEGER);
ps.setNull(4, JDBCType.VARCHAR);
i didn't get from other explanations why it is wrong
Re: About Question enthuware.ocpjp.v11.-2-.3667 :
Moderator: admin
-
- Posts: 3
- Joined: Fri Jul 04, 2014 7:46 am
- Contact:
-
- Site Admin
- Posts: 10065
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v11.2.3667 :
It is wrong for the exact same reason option 1 is wrong. Already explained in detail:
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, it has INTEGER and VARCHAR for int and String values respectively. STRING is not a valid constant in this class.
java.sql.JDBCType also defines the same names (i.e. INTEGER and VARCHAR, among others) but it is an enum.
If you like our products and services, please help us by posting your review here.
-
- Posts: 3
- Joined: Fri Jul 04, 2014 7:46 am
- Contact:
Re: About Question enthuware.ocpjp.v11.2.3667 :
The first option is wrong, because it has "ps.setNull(4, JDBCType.STRING);", where JDBCType.STRING is not a valid constant.
Also the first option is different from the 2nd in only one line, which is "ps.setNull(4, JDBCType.VARCHAR);" in the second line. And it is correct. JDBCType has VARCHAR as value. So why it is wrong?
Sorry if i'm missing smth
Also the first option is different from the 2nd in only one line, which is "ps.setNull(4, JDBCType.VARCHAR);" in the second line. And it is correct. JDBCType has VARCHAR as value. So why it is wrong?
Sorry if i'm missing smth
-
- Posts: 3
- Joined: Fri Jul 04, 2014 7:46 am
- Contact:
Re: About Question enthuware.ocpjp.v11.2.3667 :
sorry, i got it. The type itself is incorrect. It must be java.sql.Types class
Who is online
Users browsing this forum: abcackle, Bing [Bot] and 104 guests