hi ,
I three classes .I am passing an object from class node to class mainhandler's method mtd(int object). and want it to be stored in an array ,its not working
public class mainhandler { public node[] n; public static int a; public static void main(String[] args) { node[] n=new node[0]; } public int mtd(int a,packet pobj) { n[0].packet[0]=pobj; .......................................................>i can not assign pobj to array here return a=a+ pobj.interval; }} public class node { int b; node[] packet=new node[0]; public void add(){ packet pobj=new packet(1,2,3); mainhandler obj=new mainhandler(); obj.mtd(2,pobj); } } public class packet { int type; int interval; int senderID; public packet(int a,int b,int c) { type=a; interval=b; senderID=c; } }