This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes More arrays Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "More arrays" Watch "More arrays" New topic

More arrays

Snylt Master
Ranch Hand

Joined: Jul 07, 2001
Posts: 55
Hello everybody.
Can anyone please explain this.
Mockexam question:
Which of the following are legal array declaration. Select all correct answers.
A. int[5][]; // Correct
B. int[][]; // Not correct
C. int[]i[]; // Why is this correct?
D. int[5][5]; // Correct
E. int[][]a; // not correct
I'm just wondering why the "C" option is correct!
I have a question for the real exam to. I wonder if I can take a piece of paper and a pen into the examroom when I'm taking the exam. If I don't can anyone please help me how the best soulotion to problems like this should be solved
24 XOR 78
0XFFA & 45

Preparing for the Java 2 Certification exam

Preparing for the Java 2 Certification exam
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Snylt,
First off, this is a terrible question and one you will not see on the exam. An array declaration tells the compiler what the array's name is and what the type of its elements will be.
Using that definition we can easily say that:
A, B, and D are incorrect because no variable name is supplied.
We can also say that B and E are correct because they do supply both type and variable names.
The above can be tested out by compiling any class with choices A,B, and D. The class will not compile successfully.
If we place B or E inside a class it will compile without any errors.
IMO, you can bring in a scrap piece of paper but you must leave it behind when you leave the testing site.
Snylt Master
Ranch Hand

Joined: Jul 07, 2001
Posts: 55
Thanks Manfred. This question was obviously porly written , and
with wrong answers!
Anyways... thanks you for sorting this out for me.

Preparing for the Java 2 Certification exam
I agree. Here's the link:
subject: More arrays
jQuery in Action, 3rd edition