4. Declarations and Access Control

4.1 (d)

In Java, arrays are objects. Each array object has a final field named length that stores the size of the array.

4.2 (a)

Java allows arrays of length zero. Such an array is passed as an argument to the main() method when a Java program is run without any program arguments.

4.3 (c)

The [] notation can be placed both before and after the variable name in an array declaration. Multidimensional arrays are created by constructing arrays that can contain references to other arrays. The expression new int[4][] will create an array of length 4, which can contain references to arrays of int values. The expression new int[4][4] will create the same array, but will in addition create four more arrays, each containing ...

Get Programmer's Guide to Java™ Certification, A: A Comprehensive Primer, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.