This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to retirive

 
Venkat basa
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

i have an arraylist

i.e ArrayList al=new ArrayList();

al.add(1,"one");
al.add(2,"two");
.
.
.
.
.

its compile fine but when am try to retrive it,it gives outof bound exception, why we take like this,any special purpose is there..?

please help me

Thanks
Venkat
 
Rameshwar Soni
Ranch Hand
Posts: 247
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would be nice if you can post how you are trying to retrieve the elements in your code . Read this
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Venkat basa wrote:when am try to retrive it,it gives outof bound exception, why we take like this,any special purpose is there..?


The exception occurs because you're trying to access an index that is not present in the list. The purpose for the exception is--surprise--to tell you that you've tried to access something that doesn't exist.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic