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

Doubt about Chapter 3, Review Question 2 (Java OCA 8 Programmer I Study Guide, Sybex)

 
Ntobeko Mdletshe
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I am confused why option D is part of the correct answers in problem set 2 of chapter 3 Review Questions?
 
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 Ntobeko Mdletshe,

First of all, a warm welcome to CodeRanch!

Ntobeko Mdletshe wrote:I am confused why option D is part of the correct answers in problem set 2 of chapter 3 Review Questions?

Because it's actually a correct answer

Have you ever heard of the String Literal (or Constant) Pool? If not, you should definitely read this excellent article. And also carefully re-read the section about String equality on page 117.

Hope it helps!
Kind regards,
Roel
 
Ntobeko Mdletshe
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok this is the sentence that confuse me. Taken directly from Review Answers explanation

Finally, line 8 compares one object from the string pool with one that was explicitly
constructed and returns false.


So if line 8 returns false how come is it correct?
 
Liutauras Vilda
Bartender
Pie
Posts: 2792
112
BSD VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please provide full quiz question as well as possible answers. If someone don't have that book or haven't read it yet, they won't be able to help you (even if they could).
 
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
Ntobeko Mdletshe wrote: Finally, line 8 compares one object from the string pool with one that was explicitly
constructed and returns false.


So if line 8 returns false how come is it correct?

That's a mistake in the study guide, which is already listed on the official errata overview.

Hope it helps!
Kind regards,
Roel
 
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
Liutauras Vilda wrote:Please provide full quiz question as well as possible answers.

I don't think it was required this time, because it's about an already reported errata item; not about a misunderstanding or confusion about some code snippet.
Anyway it's about this question.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic