Computer Applications

(a) Write the Java statement to initialize the first 6 odd numbers in a 3 × 2 array.

(b) What is the result of x[0][1] + x[2][1] of the above array?

Java Arrays

10 Likes

Answer

(a) x[3][2] = {{1, 3}, {5, 7}, {9, 11}};

(b) 14

Explanation
  • x[0][1] = 3.
  • x[2][1] = 11.
  • Sum = 3 + 11 = 14.

Answered By

6 Likes


Related Questions