About Question enthuware.ocpjp.ii.v11.2.1353 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
kabanvau
Posts: 8
Joined: Thu Nov 21, 2019 5:48 am
Contact:

About Question enthuware.ocpjp.ii.v11.2.1353 :

Post by kabanvau »

Hi,
This code will thow an Exception at runtime:

Code: Select all

System.out.println(rs.getString(0));
Columns are numbered from 1.

admin
Site Admin
Posts: 8943
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.ii.v11.2.1353 :

Post by admin »

Did you read the explanation? To throw an exception, the code has to compile first!
If you like our products and services, please help us by posting your review here.

kabanvau
Posts: 8
Joined: Thu Nov 21, 2019 5:48 am
Contact:

Re: About Question enthuware.ocpjp.ii.v11.2.1353 :

Post by kabanvau »

Yes, it does not compile. But it is wrong to number columns from 0.

admin
Site Admin
Posts: 8943
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.ii.v11.2.1353 :

Post by admin »

It is true that it is wrong to number columns from zero. But neither the question nor the explanation says that it is ok to number columns from 0. It just just that in this case, the given code does not compile, so the question of throwing exception does not arise.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests