Java OCA OCP Practice Question 1656

Question

Is it possible to create arrays of length zero?.

Select the one correct answer.

  • (a) Yes, you can create arrays of any type with length zero.
  • (b) Yes, but only for primitive data types.
  • (c) Yes, but only for arrays of reference types.
  • (d) No, you cannot create zero-length arrays, but the main() method may be passed a zero-length array of Strings when no program arguments are specified.
  • (e) No, it is not possible to create arrays of length zero in Java.


(a)

Note

Java allows arrays of length zero.

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




PreviousNext

Related