• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
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: 139
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: 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
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!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!