Thanks NORm,
how can i generalize this code in a way that the code checks for the packet.type in the datalist,if its not there it stores it to any available location???
the problem with...
Type: Posts; User: jack_nutt
Thanks NORm,
how can i generalize this code in a way that the code checks for the packet.type in the datalist,if its not there it stores it to any available location???
the problem with...
if ( nodeobj[0].datalist[0] == null) // if first element in datalist is empty
{
nodeobj[0].datalist[0]=nodeobj[0].pkt;
System.out.println("object stored");
}
else
{
for(int...
Norm one last word: Can you please design a code that
checks the nodeobj[0].datalist[i] list and if it is empty stores nodeobj[0].pkt in it and if not empty compares if node[0].pkt.type...
the problem is that the mehtod should run once.
else
{
for(int i=0;i<3;i++)
{ ifnodeobj[0].datalist[i] != null){
nodeobj[0]!=null ; check is wrong sorry about that
No. its like nodeobj[0]'s datalist[0]th element is null -if it has nothing stored....isnt it so ?
i did mention pkt object in my coding in previous post ... i found out that i could not explain you my problem perfectly,sorry about that.
now i want to check the datalist for each nodeobj and...
i need nodeobj[0].datalist[0] in class b's method
the main task here is that i need to check for each nodeobj its datalist and check if its empty(initializing wont let me do taht with !=null) and...
I want class c's object " datalist" to hold objects by referencing like nodeobj[0].datalist[0]= this object.... but for that i am instantiating the objects in a's constructor...i am doing this so...
public class b {
static a[] nodeobj=new a[3];
public static void main(String[] args) {
nodeobj[0]=new a(123);
nodeobj[1]=new a(44);
nodeobj[2]=new a(3);
tun(); }
Norm thanks, let me xplain a bit more
I have a main class in which i make 'nodeobj' objects of node class.
Each nodeobj has its own location,type etc.
now i also want a datalist for each...
Norm,
i want :
nodeobj[0].datalist[0].t
nodeobj[0].datalist[1].t
nodeobj[0].datalist[2].t
public class b {
static a[] nodeobj=new a[3];
public static void main(String[] args) {
nodeobj[0]=new a(123);
nodeobj[1]=new a(44);
nodeobj[2]=new a(3);}
public class a {