Reputation: 14227
Hi I have to create a matrix of object with certain dimension.is it possible.the dimension of the matrix are int while the content are object.How can I do?
Upvotes: 1
Views: 15350
Reputation: 7683
A little search does not harm. It's really simple.
Object[][] matrix = new Object[rows][cols];
Upvotes: 5
Reputation: 44746
You need something like
myobjectMatrix foo[][] = new myobjectMatrix[width][height]
// Remember that everything in the matrix is initialized to null so
// you must initialize everything
foo[0][0] = new myobjectMatrix();
Upvotes: 5