• 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
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

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: 71633
312
  • 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: 71633
312
  • 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: 40354
819
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
  • Likes 1
  • 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.



 
The only cure for that is hours of television radiation. And this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic