Array related question

Associate
Joined
4 Mar 2007
Posts
315
Location
United Kingdom
Okay, so I'm figuring out the differences between Java and C# at the moment as I usually mess around with Processing.org's - processing language.

I've seen in for example C#

Code:
float className[,] objectName = new Classname[ firstPart , secondPart ];

and was wondering what is Java's equivalent. Is this the same as

Code:
float className[][] objectName = new ClassName[firstPast][secondPart];

or is the C# still a single dimensional array with two components in it?
 
Last edited:
You're correct that the functionality is in essence the same, however they are different. More info on exactly what the differences are is here.

The 'int[,] x' syntax is the textbook method of declaring a multi-dimensional array, however you can also use 'int[][] x;' in C#, it's called a 'Jagged array' or 'Array of Arrays' - a full list of array types is here
 
Last edited:
Back
Top Bottom