Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Rani Singh   on Nov 06 In Java Category.

  
Question Answered By: Erin Dunn   on Nov 06

all that calling System.out.print on an object will do is print  the
toString() method of the object.
The default behaviour of toString() (from Object) is to give you the
handle of the object.
What you are seeing is the handle (or pointer except that java  doesn't
have pointers) to
the memory  that the array  occupies. When you give it a[0] it is showing
an int  and the default
is to print those directly - which means you get the value output.

Share: