Home >
Tutorials >
Write Code Segments that Require Two-Dimensional Arrays
Write Code Segments that Require Two-Dimensional Arrays
Need Help? Check out these resources!
Your Turn
- Write program code to complete the provided tasks.
- Run the code in the Java Playground to see if your code generates the desired result.
- Make necessary changes until you have satisfied the tasks.
Practice 1: Temperatures Array
- Write a code segment that initializes a 7x24
double array for storing hourly temperatures over a week and sets all values to 0.0 as a default.
- Try the code in the Java Playground to verify your prediction.
Practice 2: Alternating True and False
- Create a
boolean[][] board that is a 5x5 two-dimensional array. The values should alternate between true and false. Even rows will start with true and odd rows will start with false.
- Try the code in the Java Playground to verify your prediction.