aspose file tools*
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
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "arrays" Watch "arrays" New topic
Author

arrays

velan vel
Ranch Hand

Joined: Nov 15, 2005
Posts: 137
hai
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

by
velan vel
premraj cheguri
Greenhorn

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

Joined: Dec 27, 2005
Posts: 26
Hi,
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
Greenhorn

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

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).
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: arrays