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 Programmer Certification (SCJP/OCPJP) and the fly likes 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 » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "arrays" Watch "arrays" New topic


velan vel
Ranch Hand

Joined: Nov 15, 2005
Posts: 137
can any one give ans for this question

1. byte [] arry1, array2[];
2. byte array3 [][];
3. byte[][] array4;
If each array has been initialized, which statement will cause a compiler error?
A. Array2 = array1;
B. Array2 = array3;
C. Array2 = array4;
D. Both A and B
E. Both A and C
F. Both B and C

velan vel
premraj cheguri

Joined: Feb 20, 2005
Posts: 21
I think the answer is A
santosh kothapalli

Joined: Dec 27, 2005
Posts: 26
array2 is two dimensional array and cannot be referenced with one dimensional array array1 so the option is A

Santosh K<br />SCJP 1.4,SCWCD
chennur gudur

Joined: Dec 29, 2005
Posts: 8
I think the answer is F
Suiram Namuen

Joined: Jan 03, 2006
Posts: 3
But what makes array2 a two-dimentional array? I don't understand the syntax.
Sandeep Prabhakar
Ranch Hand

Joined: Dec 22, 2005
Posts: 59
Consider the statement
"byte [] arry1, array2[];"
This is same as
byte[] arry1;
byte[] array2[];

Since the first "[]" is associated with the datatype (byte in this case), it is applicable to all the identifiers that follows (of course they should be comma seperated).
I agree. Here's the link:
subject: arrays
It's not a secret anymore!