I am getting lot compilation errors while compiling the program below.
The errors are occuring on all the lines commented in the above code. I'm specifically interested to know why the line "hms = new float[2][5];" fails in compilation. Can anybody please explain this to me?
You always need to be careful when declaring several arrays on one line. The lineis actually decalring a two dimensional array of floats and a one dimensional array of floats. It is equivalent to
Declare all your arrays on separate lines and then it should be more clear.
Joanne
Kiran Sonaje
Greenhorn
Joined: Aug 23, 2004
Posts: 23
posted
0
Hi Joanne,
Thanks for the reply.
For the above java code I am getting following compilation error
As per your suggetion if it is one dimensional array how does compiler complaining about 3 dimensional array. What you explained is solution for compilation and i am expecting what is the root cause for this? How JVM is handing this mechanism.
Waiting for reply .
Thanks
Kiran
Joanne Neal
Rancher
Joined: Aug 05, 2005
Posts: 3011
9
posted
0
My mistake. will declare a three dimensional array. So the reason for your compilation error is that you are trying to assign a two dimensional array to a three dimensional array reference.
Kiran Sonaje
Greenhorn
Joined: Aug 23, 2004
Posts: 23
posted
0
Thanks Joanne
But this is not really i was expecting. I wanted why not how?