How can we store elements in arraylist? as by using index or by node?

Questions by sadashivarao   answers by sadashivarao

Showing Answers 1 - 13 of 13 Answers

Farhan

  • May 14th, 2006
 

by index

  Was this answer useful?  Yes

Lokesh

  • May 14th, 2006
 

We can store elements in arraylist by using index

  Was this answer useful?  Yes

sowjanya

  • May 18th, 2006
 

by index

  Was this answer useful?  Yes

rupa

  • May 19th, 2006
 

how can we store ele in arraylist

  Was this answer useful?  Yes

satya

  • May 19th, 2006
 

It is by index

  Was this answer useful?  Yes

Pushpa

  • May 19th, 2006
 

by index

  Was this answer useful?  Yes

Bhushan

  • May 20th, 2006
 

1)The interface that ArrayList implements is List.

The method that is availble in List interface is

Object add(int index , Object element);

2)or the interface that List interface implemets is Collection.

The method that is available in Collection is :-

boolean add(Object element);

So either of the methods can be used to store elements in ArrayList.

  Was this answer useful?  Yes

abdul khalik

  • May 22nd, 2006
 

 using following methods

1) Object add(int index , Object element);

2)boolean add(Object element);

  Was this answer useful?  Yes

Naresh

  • May 22nd, 2006
 

by index

  Was this answer useful?  Yes

rameshnaidu

  • May 22nd, 2006
 

by index

  Was this answer useful?  Yes

shivalak

  • May 23rd, 2006
 

There are two ways of storing the object as elements into an ArrayList.
1. Insert an object
2. Append an object.
1. If you want to insert an object into ArrayList then you should specify the index
    The method to use is : add(int index, Object element)
2. If you want to append an object into ArrayList then no need to specify the index.
It will be automatically appended in it to the last index.
    The method to use is : add(Object element)

  Was this answer useful?  Yes

lakshmi

  • May 24th, 2006
 

by using index

  Was this answer useful?  Yes

maneesh

  • May 24th, 2006
 

    by using index.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions