public class Test { public static void main(String[] args) { int[] [] [] data = {{{1, 2}, {3, 4}}, {{5, 6}, {7, 8}}}; System.out.print(data [1] [0] [0]); } }
Added by Kevin R.
Close
Step 1
The array is initialized with two 2D arrays. The first 2D array contains two 1D arrays: `{1, 2}` and `{3, 4}`. The second 2D array contains two 1D arrays: `{5, 6}` and `{7, 8}`. Show more…
Show all steps
Your feedback will help us improve your experience
Eduard Sanchez and 91 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
What is the value of vals[4][1]? double[][] vals = {{1.1, 1.3, 1.5}, {3.1, 3.3, 3.5}, {5.1, 5.3, 5.5}, {7.1, 7.3, 7.5}}; 1.1 7.1 7.3 An ArrayIndexOutOfBoundsException error
Eduard S.
Given a two-dimensional array x of doubles, write an expression whose value is twice the value of the element in the 3rd row and the 2nd column. Declare a 3x3 two-dimensional array of integers named tic-tac-toe.
Akash M.
A student is taking 3 courses: Course 1, Course 2 and Course 3. Each course is graded using 4 tests: Test 1, Test 2, Test 3 and Final Exam. The final score in each course is the average of the scores in the four tests. John Doe’s scores in the four courses are as follows: Test 1 Test 2 Test 3 Final Exam Course 1: 70 85 67 90 Course 2: 60 63 72 70 Course 3: 90 87 93 80 You can represent this using a two-dimensional array. Assuming the scores are always positive integers between 0 and 100: int scores[3][4] = { {70, 85, 67, 90}, {60, 63, 72, 70}, {90, 87, 93, 80} }; Your output should be similar to (but doesn’t have to look exactly the same as) Average course 1 78 Average course 2 66 Average course 3 88 The averages are rounded to the nearest int. All the calculations MUST be carried out using the two-dimensional array scores presented above by means of loops that collect, for one course at a time, the scores on that course, finds their average and display the result. Then it loops back to the second course, etc
Shu N.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD