• Post Reply Bookmark Topic Watch Topic
  • New Topic

Exam, Random question related to java.time package (Java OCA 8 Programmer I Study Guide)

 
Saad Benbouzid
Greenhorn
Posts: 21
Chrome IntelliJ IDE Oracle
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is answer D a correct answer ?



This code can't compile with solely the mentioned import : "import java.time.LocalDate;", because the import for the <Month> class is missing, as you can see :


So in my opinion as it is answer D is not correct, or answer D should be "java.time.LocalDate; import java.time.Month" instead of just "java.time.LocalDate".
 
Roel De Nijs
Sheriff
Posts: 10763
148
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saad Benbouzid wrote:So in my opinion as it is answer D is not correct, or answer D should be "java.time.LocalDate; import java.time.Month" instead of just "java.time.LocalDate".

You are absolutely correct! That's a mistake and should be fixed. Many possible solutions: replace Month.JUNE with 6, mark only answer option C as the correct answer, update the answer options adding the import for java.time.Month as well,...

Hope it helps!
Kind regards,
Roel
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36002
422
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Agreed. It should have said 6 instead of Month.JUNE.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!