0
Is we can add multiplye values at a single index in arraylist??
Basically, I want to add contact details of different person eg. Name, contact number, email etc. So is I can store all the things related to single person on one index value or not?
3 ответов
+ 2
Yes you can. Just like CarrieForle has mentioned, all you need to do is create a class and pass the objects to the list.
List<Person> list = new ArrayList<Person>();
list.add(new Person(name,contact,email));
Something similar.
+ 1
You can make a class "person" with attributes that a person has, and store the objects of the class in the arraylist.
0
Ok got it.
thanks both of you.