• 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:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

Working with Dates and Times (Java OCA 8 Programmer I Study Guide)  RSS feed

 
Greenhorn
Posts: 18
3
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have found 2 minor "errors" in the "OCA Java SE 8 Programmer I" book.

On page 141, a parameter name is missing in the last method signature:
public static LocalDateTime of(LocalDate date, LocalTime <missing>)

On page 147, after the following code: Period wrong = Period.ofYears(1).ofWeeks(1);
the explanation gives the following lines of code:
Period wrong = Period.ofYears(1);
wrong = Period.ofWeeks(7); --> should be replaced with : wrong = Period.ofWeeks(1);

Is that correct?
 
Sheriff
Posts: 11338
177
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Cedric Georges wrote:On page 141, a parameter name is missing in the last method signature:
public static LocalDateTime of(LocalDate date, LocalTime <missing>)


According to the javadoc of LocalDateTime, the method signature should be (as you would probably expect):

Cedric Georges wrote:On page 147, after the following code: Period wrong = Period.ofYears(1).ofWeeks(1);
the explanation gives the following lines of code:
Period wrong = Period.ofYears(1);
wrong = Period.ofWeeks(7); --> should be replaced with : wrong = Period.ofWeeks(1);


Yes, it's incorrect! Probably because in the previous code snippet 7 days is used to simulate 1 week. The correct code should be:And maybe it would even better to have the following code (as it's the perfect equivalent of Period everyYearAndAWeek = Period.of(1, 0, 7);:

Hope it helps!
Kind regards,
Roel

(PS. I notified the authors of these errata items)
 
Cedric Georges
Greenhorn
Posts: 18
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you!
 
author & internet detective
Marshal
Posts: 38687
677
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Added both to the errata list. Thanks for pointing these out!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!