• 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

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

 
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".
 
Sheriff
Posts: 11338
177
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
 
author & internet detective
Marshal
Posts: 38681
677
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!