Unit 8 - 2D Arrays Accessing and Updating

Intro Declaring, Initializing Accessing, Updating Traversing Algorithms

Accessing and updating the values of a 2D array

In Java, accessing and updating values in a 2D array is done using the row and column indices. The general format is:

- **Accessing a value**: array[row][column]
- **Updating a value**: array[row][column] = newValue;

image

Popcorn Hack 1 (Part 2)

  • Update the values of the array, you made in part 1 to the group members in another group
String[][] bob = new String[2][2];

bob[0][0] = "Ian";
bob[0][1] = "Srijan";
bob[1][0] = "Tarun";
bob[1][1] = "Jonathan";

bob[0][0] = "Aidan";
bob[0][1] = "Saathvik";
bob[1][0] = "Sri";
bob[1][1] = "Tanav";

Comments

You are seeing this because your Disqus shortname is not properly set. To configure Disqus, you should edit your _config.yml to include either a disqus.shortname variable.

If you do not wish to use Disqus, override the comments.html partial for this theme.