COMP 202 Lecture 18: COMP 202 - Lecture 18 - Oct 17, 2016

15 views3 pages
jc123 and 40170 others unlocked
COMP 202 Full Course Notes
100
COMP 202 Full Course Notes
Verified Note
100 documents

Document Summary

Three main ways to create 2d arrays: int[][] a = {{1,2,3},{5,6}}, int[][] a = new int[4][5], int[][] a = new int[3][]; The first element in the array is another array of length 3 (with values 1,2,3). The second element is an array of length 2 (with values 5,6) int[][] a = new int[4][5]; rectangle. Each element in the array is an array of length 5. Since this is a 2d int array, all values in the grid are initialized to zero int[][] a = new int[3][]; Each element in the array will be an array. However, the elements are currently empty, and so have the value null. When any reference type is declared but not initialized, it is given the value null. Null indicates an empty address if you print it, it will just say null null null . Method that takes as input a 2d integer array and an integer number.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents

Related Questions