Review Questions

4.1 Given the following declaration, which expression returns the size of the array, assuming the array has been initialized?
int[] array;

Select the one correct answer.

  1. array[].length()

  2. array.length()

  3. array[].length

  4. array.length

  5. array[].size()

  6. array.size()

4.2 Is it possible to create arrays of length zero?

Select the one correct answer.

  1. Yes, you can create arrays of any type with length zero.

  2. Yes, but only for primitive data types.

  3. Yes, but only for arrays of object references.

  4. No, you cannot create zero-length arrays, but the main() method may be passed a zero-length array of String references when no program arguments are specified. ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.