> in_extension.java:38: '(' or '[' expected
> gamefield[laufx][laufy] = new node;
> ^
> 1 error
>
> So whats wrong here?
gamefield[laufx][laufy] = new node();
Class names begin with uppercase letters, please fix this!
--
Mike W
> Hi,
>
[quoted text clipped - 10 lines]
>
> node [][] gamefield = new node[getWidth()][getHeight()];
at this point you have your two dimensional array of nodes
> for (int laufx=0; laufx < gamefield.length; laufx++)
Here gamefield.length will give you the size of the first dimension of
your array (from getWidth() above). If you need it, gamefield[0].length
will give the other dimension.
> {
> gamefield[laufx] = new node[ gamefield[laufx].length ];
Whoops! Here you are creating another single dimension array (which I
don't think you need, and then trying to assign it to a cell in your
original array - but to do that you would need to specify both indices -
something like gamefield[x,y].
> for (int laufy=0; laufy < gamefield[laufx].length; laufx++)
> {
> gamefield[laufx][laufy] = new node;
new node(); to call node's constructor. Note that convention has it
that class names should start with a capital letter, so Node would be a
better name than node.
> };
> };
[quoted text clipped - 14 lines]
>
> Any suggestions??
node [][] gamefield = new node[getWidth()][getHeight()];
for (int laufx=0; laufx < gamefield.length; laufx++)
{
for (int laufy=0; laufy < gamefield[laufx].length; laufx++)
{
gamefield[laufx][laufy] = new node();
}
}
would create your array and fill it with default nodes.
Mark
>I want to program a 2 dimensional array of objects. So far I've got
>following code snippet (note node is not finished yet just a skeleton):
see http://mindprod.com/jgloss/gotchas.html#MATRIX

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.