Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • 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: 38250
623
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: 38250
623
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.
 
This parrot is no more. It has ceased to be. Now it's a tiny ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!