• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

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

 
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.
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • 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.
 
author & internet detective
Posts: 39435
768
Eclipse IDE VI Editor Java
  • 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!
 
Humans and their filthy friendship brings nothing but trouble. My only solace is this tiny ad:
Enterprise-grade Excel API for Java
https://products.aspose.com/cells/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!