• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Possible mistake in OCA mock up test, string equality

 
Ranch Hand
Posts: 234
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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]
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 234
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah, my apologies, yes I had the official errata, I was simply looking in the wrong place, sorry!
reply
    Bookmark Topic Watch Topic
  • New Topic