This week's book giveaway is in the Kotlin forum.We're giving away four copies of Kotlin for Android App Development and have Peter Sommerhoff on-line!See this thread for details.
Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
• Campbell Ritchie
• Liutauras Vilda
• Devaka Cooray
• Jeanne Boyarsky
• Bear Bibeault
Sheriffs:
• Junilu Lacar
• Paul Clapham
• Knute Snortum
Saloon Keepers:
• Ron McLeod
• Tim Moores
• Stephan van Hulst
• salvin francis
• Carey Brown
Bartenders:
• Tim Holloway
• Frits Walraven
• Ganesh Patekar

# Arrays

Greenhorn
Posts: 6
can anybody help me by explaining the following.
byte[ ] A[ ],B;
byte[ ][ ] C[ ][ ],D[ ][ ];
Which of these will cause an Error?
P) A=B;
Q) B=C;
R)C=D;
S)Both P and Q;
T)Both R and S;

Ranch Hand
Posts: 1070
Without testing it, I would think the answer would be T, all of them cause an error.
A is a two dimension array of bytes A[][]
B is a one dimenison array of bytes B[]
C is a four dimension array of bytes C[][][][]
D is a two dimesion array of bytes D[][]
So the only assignment that I think is legal would be A to D or vice versa. That isn't one of your choices, so I think they are all illegal.
Also, I am moving this to the certification forum for more comments.
Bill

Ranch Hand
Posts: 53
No.
I think D is byte[][][][] too.
So only C=D; ir the right answer.

Originally posted by bill bozeman:
Without testing it, I would think the answer would be T, all of them cause an error.
A is a two dimension array of bytes A[][]
B is a one dimenison array of bytes B[]
C is a four dimension array of bytes C[][][][]
D is a two dimesion array of bytes D[][]
So the only assignment that I think is legal would be A to D or vice versa. That isn't one of your choices, so I think they are all illegal.
Also, I am moving this to the certification forum for more comments.
Bill

[This message has been edited by ego hu (edited March 26, 2001).]

Ranch Hand
Posts: 61
So is S the correct answer ?

Ranch Hand
Posts: 44

Originally posted by Gaurav Mantro:
So is S the correct answer ?

Yes.

 All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad: RavenDB is an Open Source NoSQL Database thatâ€™s fully transactional (ACID) across your database https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database