Results 1 to 2 of 2
Thread: mutiple object
- 01-07-2011, 12:27 AM #1
Member
- Join Date
- Jan 2011
- Posts
- 8
- Rep Power
- 0
mutiple object
hi
i want to creat a multiple object for receiver class then pass this object R1 to other constructor of classes.i have confusion that other constructor add in this loop or outside the loop. .
using this code:
Receiver[] R1=new Receiver[4];
for(int i=1;i<=3;i++)
{
R1[i]=new Receiver(Que1,tid1,rRandom1,"Receiver",i);
Channel ch1 = new Channel(waitQue1, q1, RTT1,FieldSize1,tid1,R1,chRandom1,i);
}
is this code generate 3 times ch1 or only one time.
hope some body help me.
- 01-07-2011, 12:57 AM #2
it will generate a ch1 each and every time the for loop is invoked.
in this case since ch1 is declared inside the for loop, the next iteration of the loop the reference to it will be lost, and it will be garbage collected.. unless there is a refence to this from somewhere else. e.g. if there was a list of these outside of the array,
Similar Threads
-
Storing Mutiple Classes/Data Types in a Linked List
By Chronoattica in forum New To JavaReplies: 7Last Post: 12-28-2010, 10:03 PM -
issue of mutiple panels
By de.megha in forum AWT / SwingReplies: 1Last Post: 07-26-2010, 09:27 AM -
Create object of unknown class, based on existing object
By Zack in forum New To JavaReplies: 2Last Post: 06-22-2010, 04:29 AM -
Mutiple Selection without control key in Tree componet
By atmohsin in forum SWT / JFaceReplies: 0Last Post: 03-24-2010, 10:39 AM -
how to pass an arraylist from an object back to the parent object that it was created
By george_a in forum New To JavaReplies: 1Last Post: 03-04-2009, 06:14 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks