Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Java Quiz 18: Multidimensional Arrays

DZone's Guide to

Java Quiz 18: Multidimensional Arrays

Let's take a look at the answer to our last quiz (dealing with Arrays) before jumping into this week's puzzle, which tackles working with multidimensional Arrays.

· Java Zone ·
Free Resource

Java-based (JDBC) data connectivity to SaaS, NoSQL, and Big Data. Download Now.

Before we start with this week's quiz, here is the answer to Java Quiz 17: Working With Arrays

The expression to the left of the brackets is fully evaluated before any part of the expression within the brackets is evaluated.

  1. We can simplify the statement System.out.print(arrA[(arrC = arrB)[(arrA = arrC)[4]]]); as System.out.print(arrA[arrB[arrB[4]]]);.
  2. arrB[4] = 5, arrB[5] = 4. arrA[4] = 6

The correct answer is: B.

Here Is the Java Puzzle for Today!

Write one statement on line 11 to print the element with the value of 18 to the standard output.

public class MyArray
{
    public static void main(String[] args)
    {
        int[] array[][] = {
            null,
            {{1, 2, 3, 4, 5}},
            new int[3][],
            {{6, 7, 8, 9, 10, 11}, {12, 13, 14, 15}, {16, 17, 18, 19}}
        };
        // line 11: Write your statement here!
    }
}


The correct answer and its explanation will be included in the next quiz in two weeks! For more Java quizzes, puzzles, and assignments, take a look at my site!

Connect any Java based application to your SaaS data.  Over 100+ Java-based data source connectors.

Topics:
java ,multidimensional arrays ,java quiz ,arrays

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}