2DWorlds Forums
I found this interesting (Java) - Printable Version

+- 2DWorlds Forums (http://2dworlds.buildism.net/forum)
+-- Forum: Off Topic (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=5)
+--- Forum: Programming (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=30)
+--- Thread: I found this interesting (Java) (/showthread.php?tid=8788)



I found this interesting (Java) - Chaos - 01-15-2012

A multidimensional array!

In the Java programming language, a multidimensional array is simply an array whose components are themselves arrays.

[lua]
class MultiDimArrayDemo {
public static void main(String[] args) {
String[][] names = {
{"Mr. ", "Mrs. ", "Ms. "},
{"Smith", "Jones"}
};
// Mr. Smith
System.out.println(names[0][0] +
names[1][0]);
// Ms. Jones
System.out.println(names[0][2] +
names[1][1]);
}
}
[/lua]


RE: I found this interesting (Java) - Qwertygiy - 01-15-2012

Lua does this too, with tables. It's awesome for semi-advanced projects. It really shortens up long lines of messy code.


RE: I found this interesting (Java) - Blizzard - 05-04-2012

It's the same in most languages. Useful for lots of things.