• Post Reply Bookmark Topic Watch Topic
  • New Topic

Errata: OCP Oracle Certified Professional Java SE 8 Programmer II - Chapter 10  RSS feed

 
Greenhorn
Posts: 4
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Page 573 answer to question 19.
System.out.println(rs.relative(-100)); results in java.sql.SQLException.
So option G is also correct.

The following explanation isn't correct

The fifth println outputs false because the cursor is located before the beginning of the result.

 
author & internet detective
Marshal
Posts: 37708
575
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just re-ran the code with Java 8 and Derby. It did not throw an exception.

Can you post the exact code you ran? And what version of Java did you use? With Derby or a different database?
 
Yuriy Derevyanko
Greenhorn
Posts: 4
1
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeanne,

Yes, I used Derby.
I restarted the system, dropped & created animal table, now System.out.println(rs.relative(-100)) doesn't throw exception and prints false as it should. Not sure what was the cause of the problem...
So please disregard this thread.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37708
575
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah. So it was probably that you had different data in the table than you thought.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!