This site requires JavaScript, please enable it in your browser!
Greenfoot back
2woodsway
2woodsway wrote ...

2011/11/14

Please Help!!

2woodsway 2woodsway

2011/11/14

#
Given an ArrayList a , write an expression that refers to the first element of the ArrayList. So, if the array a held the following values: 33,14,97,265, 84, then the value of your expression should be 33. I tried: Object obj = arrayList.get(33); What am I doing wrong?
keiko1dog keiko1dog

2011/11/14

#
the ArrayList is "a" and the first element is indexed to "0" so to refer to the fist element it would be: a.get(0); If you go to page 73 in the Greenfoot book and read there you be able to understand it better.
2woodsway 2woodsway

2011/11/14

#
Thanks so much, I think I get it, a.get(o) refers the the first number in this situation which would be 33!! I'm so excited!!!
You need to login to post a reply.