Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

illegal array reference assignments

 
sonia jaswal
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. 1-D array cannot be assigned to a 2-D array.
2. Nonarray object cannot be assigned to a 2-D refernce.
3. Nonaraay object cannot be assigned to a 1-D array reference.
4. Array Object cannot be assigned to a nonarray reference.

Can anybode please help me out in understanding these exception with an example....???
 
Phani Burra
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. 1-D array cannot be assigned to a 2-D array.
int[][] x;
int[] y;
Assuming the y has been initialised with some int values
x=y; gives type mismatch error cannot convert from int[] to int[][]
but x[0]=y; is correct.

2. Nonarray object cannot be assigned to a 2-D refernce.
3. Nonaraay object cannot be assigned to a 1-D array reference.
4. Array Object cannot be assigned to a nonarray reference.

2,3,4 are obvious because you cannot assign a String object to an Array reference and cannot assign Array obj to a String reference.Hope this info helps
 
Something must be done about this. Let's start by reading this tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!