javampimpj-express

how 2D array pass as object in MPJ


I am trying to pass 2d array as object in MPJ library but it gives error at this line

Object sendobject = new Object[1];
sendobject[0] = (Object)g.adjMatrix;  
//Graph g = new Graph();
// adjmatrix is public member of class Graph having detail of 
// connecting nodes to each other 

Im currently follow the example of this blog.


Solution

  • I am not sure, why you create an array with one element, but this:

    Object sendobject = new Object[1];  
    

    does not work. Either you want an array:

    Object[] sendobject = new Object[1];  
    

    or you want only one Object

    Object sendobject = (Object)g.adjMatrix;