aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "array" Watch "array" New topic
Author

array

thrilok nath
Greenhorn

Joined: Aug 09, 2007
Posts: 1
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 object references.
d.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.
e.No, it is not possible to create arrays of length zero in Java.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Welcome to JavaRanch!

The best way to learn (especially when preparing for the SCJP exam) is to write lots of test code. Have you tried to create primitive/object arrays of length zero and verify their length?


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Anup Jadhav
Greenhorn

Joined: Jun 09, 2007
Posts: 9
Well said, Marc !

Thrilok, I've tried out this and the correct answer is 'a'.
You can create an array of any type, of length 0.

Anup


I code therefore I am.
Jianghu Li
Greenhorn

Joined: Sep 01, 2007
Posts: 13
A is correct!

Output is:
 
 
subject: array