This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

arrays

 
velan vel
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the answer is A
 
santosh kothapalli
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
array2 is two dimensional array and cannot be referenced with one dimensional array array1 so the option is A
 
chennur gudur
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the answer is F
 
Suiram Namuen
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But what makes array2 a two-dimentional array? I don't understand the syntax.
 
Sandeep Prabhakar
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic