Two Dimensional Arrays and Arraylist
Two Dimensional Arrays and Arraylist
ArrayList
Lecture 3
Two-Dimensional Arrays
• Declaring a two-dimensional array requires two sets of
brackets and two size declarators
– The first one is for the number of rows
– The second one is for the number of columns.
double[][] scores = new double[3][4];
• The two sets of brackets in the data type indicate that the
scores variable will reference a two-dimensional array.
• Notice that each size declarator is enclosed in its own set of
brackets.
Accessing Two-Dimensional Array Elements
• }
• Public static void main(String[] args)
• {
• Method1(numbers);
• }