SJSU/Udacity CS046

Problem Set 8

  1. 2D Arrays
  2. Print 2D
  3. Fill 2D
  4. Class Design
  5. Static Method
  6. Manipulating Pictures
  7. Window Glass
  8. Robot

2D Arrays

Complete the code to declare and instantiate a two dimensional array of ints with 4 rows and 5 columns
int[][] numbers = _________________ ;
new int[4][5]
You have a two dimensional array of ints called matrix. Write a single line of code to put 10 in the first column of the first row. matrix[0][0] = 10;
You have a two dimensional array of 5 x 10 ints called matrix. Write a single line of code to put 54 in the last column of the last row. matrix[4][9] = 54;
You have a two dimensional array of ints called matrix with an unknown number of rows and columns. Complete the statement to find the number of rows in the array.
int rows = _____________;
matrix.length
You have a two dimensional array of ints called matrix with an unknown number of rows and columns. Complete the statement to find the number of columns in the array.
int columns = _____________;
matrix[0].length

Problem on this page?

Your name:

Your email address:

Problem description:

To protect against spam robots, please answer this simple math problem:
× =