Results 1 to 2 of 2
Thread: mutiple object
- 01-07-2011, 01:27 AM #1Member
- Join Date
- Jan 2011
- Rep Power
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;
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, 01: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,
- By Chronoattica in forum New To JavaReplies: 7Last Post: 12-28-2010, 11:03 PM
- By de.megha in forum AWT / SwingReplies: 1Last Post: 07-26-2010, 09:27 AM
- By Zack in forum New To JavaReplies: 2Last Post: 06-22-2010, 04:29 AM
- By atmohsin in forum SWT / JFaceReplies: 0Last Post: 03-24-2010, 11:39 AM
- By george_a in forum New To JavaReplies: 1Last Post: 03-04-2009, 07:14 PM