aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Something intersting about arrays..!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Something intersting about arrays..!!" Watch "Something intersting about arrays..!!" New topic
Author

Something intersting about arrays..!!

Sunny Jain
Ranch Hand

Joined: Jul 23, 2007
Posts: 433

Hi Guys,

While i was playing with some codes today..I found something very interesting:


When I run this code, My expectation was:
1)Some memory reference
2)Some memory reference
3)Some memory reference
4)Some memory reference

But i got following as the output:


Thanks and Regards,
SCJP 1.5 (90%), SCWCD 1.5 (85%), The Jovial Java, java.util.concurrent tutorial
Nadeem Khan
Ranch Hand

Joined: Nov 27, 2007
Posts: 108
st's ouput is as expected but rest is something new to me


<i>If there were no Exceptions (not Errors!), Life would have kinda sucked!!</i>
Sunny Jain
Ranch Hand

Joined: Jul 23, 2007
Posts: 433

Actually the output i got of following:

System.out.println(ch);

as ch is referring to an Object(array Object) so it must refer to some memory references..as everything else is displaying..!!
Nadeem Khan
Ranch Hand

Joined: Nov 27, 2007
Posts: 108
best way to clear such things is to refer API and see the implementation of println() method..hardwork in other words
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Something intersting about arrays..!!