CSE110 Principles of Programming with Java Lecture 32: Multidimensional Arrays Javier Gonzalez-Sanchez [email protected] javiergs.engineering.asu.edu Office Hours: By appointment
Javier Gonzalez-Sanchez | CSE110 | Summer 2017 | 2 One-dimensional Array • A two-dimensional array can be thought of as a table of elements, with rows and columns 0 1 2 3 4 5 int [][]array = new int [6][3] array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2
Javier Gonzalez-Sanchez | CSE110 | Summer 2017 | 5 Multidimensional Arrays • An array can have many dimensions – if it has more than one dimension, it is called a multidimensional array • Each dimension subdivides the previous one into the specified number of elements • Each dimension has its own length constant • Because each dimension is an array of array references, the arrays within one dimension can be of different lengths
CSE110 - Principles of Programming Javier Gonzalez-Sanchez [email protected] Summer 2017 Disclaimer. These slides can only be used as study material for the class CSE110 at ASU. They cannot be distributed or used for another purpose.