Did you compile and run it? If not do so. If you do not understand the output that was printed, then ask again.
And please check our JavaRanch Naming Policy and change your displayed name to conform with it. I believe that you have been previously requested to do so in another topic's thread.
Srikanth, It gives compiler error because of incorrect use of System.ou.println. If it is a typing error and it should be Syste.out.println, it will output the memory address of the array object only. It does not print elements of the array object because it does not access array elements in this code. -Suman
Sorry, it should be System.out.println, not Syste.out.println. My computer has a problem. Suddenly a black screen appears and I miss a letter even if I type it. -Suman
The above pattern works for byte,short,int,float,double arrays. But will not work for char and long !
Why doesn't work for char:Reason: PrintStream has function which takes char[] and prints the contents. void println(char[] x) Print an array of characters and then terminate the line.
Why doesn't work for long: I too don't know. But i got this result: [J@1b90b39.
I think its waste of time in certification view point. Any way have nice time. I think we are crossing boundaries.
I don't know their reasoning, but the class name for a long[] is [J.
prints [J
The reason that SOP acts differently with a long[], int[], float[], double[], etc. than with a char[] is that there is a method named println in PrintStream which matches char[], but the only println method that the other arrays match is the one that accepts Object.