Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Assigning a array of array to an Object reference

 
ramya narayanan
Ranch Hand
Posts: 338
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,
I've an challenge with casting an 2-D array to an object reference.
When I'm trying to use the object reference index values to cast it into an one dimensional array, it throws compile time error whereas i am able to cast that object reference to another 2-D array.

This is my code

When I compile it:

Also when I try to get the values of that object reference through this


The same error is showing up in console.
Why is it happening ?
Regards
 
Peter Lawrey
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try
 
ramya narayanan
Ranch Hand
Posts: 338
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Peter!
Now it's working.



Regards.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic