java 2D arrays

0.0(0)
studied byStudied by 1 person
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/8

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 3:34 AM on 4/29/24
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

9 Terms

1
New cards

Two Dimensional Arrays

A collection of data that is stored in a table or grid, with rows and columns.

2
New cards

Rows

Horizontal

3
New cards

Columns

Vertical

4
New cards

declaration statement

datatype[][] nameOfArray = new dataType[][];

int[][] myTable = new int [4][7];

5
New cards

remember

  • first spot starts at 0

  • go down first, then to the side

  • when declaring, it counts normally

  • when choosing a spot, start from 0

6
New cards

grid.length

the number of rows

7
New cards

grid [0].length

number of columns

8
New cards

Traversing

for (int r = 0; r < myTable.length; r++ )

{

  for (int c = 0; c < myTable[0].length; c++)

   {

system.out.println(myTable[r][c]);

   }

}

9
New cards

Populating with an initializer list

int [][] grid = {  { 5, 2, 12, -4, 95} ,        //row 0

                   { 33, 59, 23, 68, 200},      //row 1

                   { 42, 87, -99, 312, 0}  } ;  //row 2

Explore top flashcards

CMS II Geriatrics: E2
Updated 289d ago
flashcards Flashcards (129)
ap gov
Updated 1020d ago
flashcards Flashcards (55)
Lec 15 Cancer
Updated 678d ago
flashcards Flashcards (22)
100 Infinitivos
Updated 184d ago
flashcards Flashcards (100)
CMS II Geriatrics: E2
Updated 289d ago
flashcards Flashcards (129)
ap gov
Updated 1020d ago
flashcards Flashcards (55)
Lec 15 Cancer
Updated 678d ago
flashcards Flashcards (22)
100 Infinitivos
Updated 184d ago
flashcards Flashcards (100)