3 Dimensional Arrays in Java Programming

This video tutorial explains the three dimensional arrays in java programming language.
You will learn how to create a three dimensional array, how to store and access values from them, how to use for loop to printout the elements of a three dimensional array in detail with example.

Source code for this video tutorial

package learningJava;

public class Tiger {

 public static void main(String[] args) {
 
  int [][][] studentsmarks = {
    
    { {33,66},{55,99} },
    { {44,55},{67,90} },
    { {4,5},{6,9} }
    
  };
  
  
 /* int [][][] studentsmarks = new int[3][2][2];
  
  studentsmarks[0][0][0] = 55;
  studentsmarks[0][0][1] = 65;
  
  studentsmarks[0][1][0] = 53;
  studentsmarks[0][1][1] = 68;
  */

 // System.out.println(studentsmarks[0][1][0]);
  
  for(int sno = 0; sno < studentsmarks.length; sno++){
   System.out.println("Student No "+(sno+1));
   for(int exam = 0; exam < studentsmarks[sno].length; exam++){
    System.out.println("Exam no "+(exam+1));
    System.out.println("marks are");
    for(int marks = 0; marks < studentsmarks[sno][exam].length; marks++){     
     System.out.print(studentsmarks[sno][exam][marks]+"\t");;
    }
    System.out.println();
   }
   System.out.println();
   
  }
  
 }

}

Back To Top