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.
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,