• 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
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

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

 
Greenhorn
Posts: 21
IntelliJ IDE Oracle Chrome
  • 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: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • 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
Posts: 39435
768
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Agreed. It should have said 6 instead of Month.JUNE.
 
"I know this defies the law of gravity... but I never studied law." -B. Bunny Defiant tiny ad:
create, convert, edit or print DOC and DOCX in Java
https://products.aspose.com/words/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!