Can you get an 2 dimensional array from 3 dimensional array without loops in Java? -


can subarray 3 dimensional array in java? i'm kind of new java , need help.

threedimensions[][][] = {     {         {false, true, false, false},         {false, true, false, false},         {false, true, false, false},         {false, true, false, false},     },     {         {false, false, false, false},         {false, true, true, false},         {false, true, false, false},         {false, true, false, false},     } };  twodimensions = threedimensions[0]; 

this way doesn't work there way without looping?

your way work, you've got syntax bit wrong. should be

boolean[][][] threedimensions = {     {         {false, true, false, false},         {false, true, false, false},         {false, true, false, false},         {false, true, false, false},     },     {         {false, false, false, false},         {false, true, true, false},         {false, true, false, false},         {false, true, false, false},     } };  boolean[][] twodimensions = threedimensions[0]; 

if problem printing out, need write

system.out.println(arrays.deeptostring(twodimensions)); 

Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -