Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

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
Sheriff
Posts: 38564
654
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
Sheriff
Posts: 38564
654
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!