Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ArrayList

 
Cougar Vis
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Me using the ArrayList library from Java for O.O programming, but i am not quite sure one 3 little things

1.Can i assign the data into a specific slot E.g "banana" a string into slot 3?

2.How do i add a data, do i use "add.xXxX"? or use "set", in O.O prgramming environment?

3.How do i recall the data from a specific slot? Using the example in #1.

Waiting for reply & Thanx in advance

Respect
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Refer to the API for ArrayList...

http://java.sun.com/j2se/1.5.0/docs/api/java/util/ArrayList.html

In particular, note the methods:
  • add(int index, E element)
  • get(int index)
  •  
    Dirk Schreckmann
    Sheriff
    Posts: 7023
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Moving this to the Intermediate forum...
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic