• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Possible mistake in OCA mock up test, string equality

 
Jason Attin
Ranch Hand
Posts: 232
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys, I noticed something in question 54 in the mock exam 1 (I was doing the online one).
I've attached a screenshot of the question with the answer.
The code there doesn't compile because it uses equal() rather than equals() and I've got to admit that I fell for it. But then I amended the code, replaced equal() with equals(), changed the output slightly so that it outputs the actual comparison, and try the code myself and that's when I spotted something


SO the explanation says that if the code compiled the correct answers would be A,C and E but it seems it's A,C and D. E doesn't make much sense as would be false and (option D) true. Is that correct?

question_54.jpg
[Thumbnail for question_54.jpg]
 
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
Did you have a look at the official errata overview for this study guide?
The question about the String “hello” says if equals() was used, the answer would be A/C/E. This is incorrect. It would be A/C/D.
 
Jason Attin
Ranch Hand
Posts: 232
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, my apologies, yes I had the official errata, I was simply looking in the wrong place, sorry!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic