15. Which of these array declarations is not legal? (Choose all that apply)
A. int scores = new int;
B. Object cubbies = new Object;
C. String beans = new beans;
D. java.util.Date dates = new java.util.Date;
E. int types = new int;
F. int java = new int;
answer : C,E,F
i dont uderstand F option .
Can anyone help me about this problem?
Correct, but there's a second reason, and that's also the same reason why F is not valid: Array instances MUST have a length. Neither E nor F has a length when you create the array.
The length of A is 5, the length of B is 3, the length of C is 6 and the length of D is 2. Passing additional lengths for nested arrays is optional. When you don't pass additional length arguments, each element of the containing array is just initialized with null.
For instance, the result of new Date is an array that looks like [null, null], where each null can be replaced with a reference to a nested array of Date.
The result of new Date is an array that looks like [[null, null, null], [null, null, null]], where each null can be replaced by a reference to a Date instance.
Another way of looking at it:
is equivalent to
30 seconds to difuse a loaf of bread ... here, use this tiny ad: