This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes confusion regarding mitidimentional array please help Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "confusion regarding mitidimentional array please help" Watch "confusion regarding mitidimentional array please help" New topic
Author

confusion regarding mitidimentional array please help

shashank pratap
Greenhorn

Joined: Aug 11, 2009
Posts: 12
class Dims{
public static void main(String[] args){
int [][] a={{1,2},{3,4}};
int[] b=(int[])a[1];
Object o1=a;
int [][] a2=(int[][])o1;
System.out.println(b[1]);
}}

the answer to this q is given is " an exception is thrown at runtime" page number 278 Kathy & Bert (310-065)
but when i compile this program on java5 compiler this showing me the output
please help m,e
M K Rayapudi
Ranch Hand

Joined: Feb 19, 2007
Posts: 157
in the text book, the following line of code is also there

int[] b2 = (int[]) o1;

check once again the text book


R6i
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: confusion regarding mitidimentional array please help
 
Similar Threads
Arraay doubt
Array assignment doubt??
SCJP array problem
Object points to double array, yet when casting it to single array, it causes Runtime error
How can we assign a primitive array into Object reference