This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Question? int[] Vs Integer[] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Question? int[] Vs Integer[]" Watch "Question? int[] Vs Integer[]" New topic
Author

Question? int[] Vs Integer[]

Chandra Bhatt
Ranch Hand

Joined: Feb 28, 2007
Posts: 1707


Output:
[12, 2, 43, 67, 4, 1, 23]
[I@5224ee


Output varies:
Isn't its answer that Integer class overrides the toString() method and in case of int[], Object class version of toString() used?

How all the values of Integer[] printed when we merely pass an reference variable. What happens inside the toString(), does it do complete traversal or use Iterator or something.

Please help!!!



cmbhatt


cmbhatt
Omer Haderi
Ranch Hand

Joined: Sep 27, 2006
Posts: 42
Hi,

In the second case you prints the array not the list, so you will get the hashCode of the Object.

here is the toString mystification !
Chandra Bhatt
Ranch Hand

Joined: Feb 28, 2007
Posts: 1707
Thanks Omer,








Regards,
cmbhatt
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question? int[] Vs Integer[]