• Post Reply Bookmark Topic Watch Topic
  • New Topic

Sybex Testbank Online Practice Exam 2 (Java OCA 8 Programmer I Study Guide)

 
Danny de Wit
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is regarding online practice exam 2 that comes with the book Java OCA 8 Programmer I Study Guide.

In one of the questions it asks:
What is the output of the following code:



The last 2 answer options are:
E. The code does not compile.
F. A runtime exception is thrown.

I answered E, because LocalDate.of(2015, 5) doesn't compile since there is no "of" method with 2 parameters.
The correct answer however is F because there is no time and it uses a DateTimeFormatter.

I thought the "Does not compile" answer always goes before all others. Can someone maybe shed some light on this question?

Thanks in advance!
 
Narayana Bojja
Ranch Hand
Posts: 135
4
Hibernate Java Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I answered E, because LocalDate.of(2015, 5) doesn't compile since there is no "of" method with 2 parameters. 

Yes . I agree with you , it gives compile time error because there is no two argument of method in LocalDate class.

Hope it helps !
 
Roel De Nijs
Sheriff
Posts: 10763
148
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Danny de Wit wrote:I thought the "Does not compile" answer always goes before all others. Can someone maybe shed some light on this question?

Did you check the official errata overview of this study guide?
 
Danny de Wit
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:
Danny de Wit wrote:I thought the "Does not compile" answer always goes before all others. Can someone maybe shed some light on this question?

Did you check the official errata overview of this study guide?


I didn't but thanks for the link!
 
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!