Skip to main content
gamedev.net
🔒 Locked

[java] matrix

Started by mill-o Dec 8, 2001 at 3:47 AM 2 replies 250+ views
Original Post
mill-o
mill-o
how do i create a new matrix? as in i know the standard way:
  
int[][] foo = new int[10][10]:

foo[0][0] = 2;
  
i want to create it another way so i can "see" the whole matrix, like
  
int[][] foo = new int[10][10];

foo = (0,0,0,0,0,0,0,0,0,
       0,0,0,0,0,0,0,0,0,
       0,0,0,0,0,0,0,0,0,
       0,0,0,0,0,0,0,0,0, // damn, i should have chosen [2][2] instead :)

       and so on.. )
  
help!
Anthracks
Anthracks
I think, if the syntax is something like C++, you would do it along these lines:

  
// a 3x3 matrix

int[][] foo = { {0,0,0},
{0,0,0},
{0,0,0} };


Basically it''s just the normal array declaration nested within another set of braces.

Anthracks

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.