• Post Reply Bookmark Topic Watch Topic
  • New Topic

printing out values from a multidim array  RSS feed

 
jon ninpoja
Ranch Hand
Posts: 291
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys,

never really looked at multi dim arrays



why is this not working?
System.out.println(multiDimArray[0,2]);

does this not mean print out from array 0 index 2 ..giving me 7?

thanks

 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Java doesn't support that syntax of dereferencing arrays.  The compiler will complain due to a syntax error.

Henry
 
Knute Snortum
Sheriff
Posts: 4276
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java doesn't have multidimensional arrays; technically it has arrays of arrays.

This will print the first array, the third index -- which is "3".
 
Carey Brown
Saloon Keeper
Posts: 3317
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could try this

Output
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!