jQuery in Action, 2nd edition
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes array problem Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "array problem" Watch "array problem" New topic
Author

array problem

Shanky Sohar
Ranch Hand

Joined: Mar 17, 2010
Posts: 1047

from kathy..........
page noc270


the answers say if i remove
int[] b2 = (int[]) o1;
then code will compile fine and prints output as 4............but how..........i am not able to understand.........
how line 01 works.................


SCJP6.0,My blog Ranchers from Delhi
Ankit Tripathi
Ranch Hand

Joined: Oct 17, 2009
Posts: 175
thers is no problem phil!
int[] b = (int[]) a[1];

in a simple way 1st not zeroth element of array a has been assigned which is "{3,4}".
and 4 will be printed because first not the "zeroth" element of array has been forced to print.
Abimaran Kugathasan
Ranch Hand

Joined: Nov 04, 2009
Posts: 2066

Have a look on here and here. Some useful topics!


|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: array problem
 
Similar Threads
array
Doubt in K & B self test
Conversion.....
Object points to double array, yet when casting it to single array, it causes Runtime error
Multi dimension array confusion