GIDForums  

Go Back   GIDForums > Computer Programming Forums > Java Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 16-Apr-2008, 04:41
05131013 05131013 is offline
New Member
 
Join Date: Mar 2008
Location: Oxford
Posts: 3
05131013 is on a distinguished road
Exclamation

Opperations on objects in ArrayList


Hello everyone,

I have fllowing problem: I have an ArrayList of Objects that have some methods defined in them as:

Class name: Array (contains array of objects)
methods: add_object()

if the ArrayList name is "l1" what would be the way of calling add_object() by using "l1".

I have already tried "l1.get(1).add_object()" kind of statements, those do not work...

cheers in advance!
  #2  
Old 25-Apr-2008, 13:14
JustinFox JustinFox is offline
Junior Member
 
Join Date: Mar 2008
Posts: 59
JustinFox will become famous soon enough

Re: Opperations on objects in ArrayList


Hello everyone,

I have fllowing problem: I have an ArrayList of Objects that have some methods defined in them as:

Class name: Array (contains array of objects)
methods: add_object()

if the ArrayList name is "l1" what would be the way of calling add_object() by using "l1".

I have already tried "l1.get(1).add_object()" kind of statements, those do not work...

cheers in advance!


-----

I don't really understand, you have an Arraylist of Arrays? And those arrays are arrays of objects you defined right?

you would do

CPP / C++ / C Code:

object [] myarray = l1.get(1);
object myobj = "hello";
for(int i = 0; i<myarray.length; i++)
myarray[i].add_object(myobj);

// where 'object' is the type of object you made. or just object if thats
// what you want.


Justin Fox

p.s.

That is java code, just could find the java tags at top
 

Recent GIDBlogFirst week of IA training by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic allocation and container objects goochcrabs CPP / C++ Forum 1 13-Apr-2007 07:48
[C++] Array of pointers to class objects Całeczka CPP / C++ Forum 2 03-Dec-2006 12:05
binary search on vector of objects sorted by strings qboy CPP / C++ Forum 8 13-Oct-2006 20:14
Array of Objects chr1zis CPP / C++ Forum 11 20-Feb-2006 16:42
How to Create C++ Objects at Runtime? wc3promet CPP / C++ Forum 4 15-Oct-2004 09:21

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 16:07.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.