This week's book giveaways are in the Angular and TypeScript and Web Services forums.
We're giving away four copies each of Programming with Types and The Design of Web APIs and have the authors on-line!
See this thread and this one for details.
Win a copy of Programming with Types this week in the Angular and TypeScript forum
or The Design of Web APIs in the Web Services forum!
  • 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
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Joe Ess
  • salvin francis

Possible Errata in OCP Java SE11 Programmer I Study Guide

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chapter 5
Title: Autoboxing and Unboxing



***: this line when run on IDE outputs "Exception in thread "main" java.lang.IndexOutOfBoundsException: Index 50 out of bounds for length 2"

but in book seems it is working fine.

kindle version  Loc 8364

aaaaaa.PNG
[Thumbnail for aaaaaa.PNG]
 
Marshal
Posts: 67013
255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please have a look through the known errata; I can't seem to find that problem there. The overlading will be resolved so the direct use of the int takes precedence over the boxed version, so you would expect to suffer an out of bounds exception.
 
Mahmoud Elkeshky
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I looked for the list of errata before posting the thread, i think you confirm the same that "it should report error" but book shows it is removing the item successfully!!!
 
Campbell Ritchie
Marshal
Posts: 67013
255
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that is what the error appears to be. Please wait because the authors monitor this forum.
 
author & internet detective
Posts: 39760
797
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Confirmed and added to the errata. I re-ran my original test code and it fails. Not sure what happened there!
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can remove the element of the ArrayList by sending an Integer Object to the remove method.



 
Always! Wait. Never. Shut up. Look at this tiny ad.
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!