• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mock 3 exam typo in explanation (Java OCA 8 Programmer I Study Guide)

 
Vincent Botteman
Greenhorn
Posts: 9
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One of the question about the String methods

The explanation starts with the sentence "Line 6 returns the number 3 since indexes are zero based." The index of number 6 in the string is 2 and not 3.
 
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
Vince Botteman wrote:The explanation starts with the sentence "Line 6 returns the number 3 since indexes are zero based." The index of number 6 in the string is 2 and not 3.

You are correct! Should definitely be Line 6 returns the number 2 since indexes are zero based. The remainder of the explanation is spot-on: total has a value of 6 (2 + 4) and charAt(4) will throw a StringIndexOutOfBoundsException.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Agreed. I'm collecting a bunch of minor exam issues and reporting to the publisher in one go. (The one about the botched question I reported as soon as I knew about it.) In the meantime, it is listed in the errata with you as the finder. Thanks for pointing it out!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic