Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Wrong Answer on Chapter Exam Two Question 7 (Java OCA 8 Programmer I Study Guide, Sybex)

 
Jim Krang
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The question asks What is the output of the following code? and states the correct answer is is D (which is 8). However, the answer should be F (Does not compile because of line 4).

The symbol x cannot be verified in the fourth line.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jim Krang,

First of all, a warm welcome to CodeRanch!

Jim Krang wrote:The symbol x cannot be verified in the fourth line.

You are incorrect! The study guide is absolutely spot-on! This code snippet compiles successfully and will print 8.Therefore the TernaryTester class is valid and will compile successfully (without any errors).

Can you explain why you think the symbol x can't be verified in line4?

Hope it helps!
Kind regards,
Roel
 
Jim Krang
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Roel,

Thank you for responding. I must have had a typo. After seeing your response I typed it in again and it works fine. Thanks a lot!
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jim Krang wrote:After seeing your response I typed it in again and it works fine. Thanks a lot!

You are welcome!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic