indexoutofthebounds exception error

James Melvin james.melvin at oracle.com
Wed Jul 14 20:44:43 UTC 2010


Hi Arshad,

This is not exactly the right list to discuss your question. This list
is to discuss the openjdk open source Java codebase. Having said that,
your bug is likely trying to retrieve the 53rd card from a 52 card deck,
i.e. when i=51 you are trying to retrieve the 52nd element (i+1), which
does not exist.

- Jim


On 7/14/10 2:57 PM, arshad wrote:
> hi can someone please tell me, why i get indexoutofthebound exception
> for this: (i+1)
> arraylist mydeck size is 52.
>
> thanks a lot.
>
> for(int i=0;i<d.mydeck.size();i++){
>              pileOne.add(d.mydeck.get(i));
>              pileTwo.add(d.mydeck.get(i+1));
> //            pileThree.add(d.mydeck.get(i+2));
> //            pileFour.add(d.mydeck.get(i+3));
>          }
>
>
>
>



More information about the discuss mailing list