• Post Reply Bookmark Topic Watch Topic
  • New Topic

what is the difference between Arrays.toString(o) and o.toString(), where o is the reference of Arry  RSS feed

 
Mukund A. Kumar
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


here i cant understand the difference between line 12 and 13.
output : [mmm, mmm]
[Ljava.lang.Object;@19ee1ac
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arrays is a class in the java.util package that contains several static methods which will produce nice output for arrays.

An array itself can call the methods of the Object class, in particular toString(), which is an instance method which normally prints a string containing information about the location in memory of the object.
 
Mukund A. Kumar
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to know that wat is the difference between these two line.


following two line are equal or not. if no then why(in detail).which class toString method is called during execution of these two line?

 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java Rock wrote:i want to know that wat is the difference between these two line.

What happens when you run them? That'll give you the answer far quicker than posting vague questions on a forum.

if no then why(in detail).which class toString method is called during execution of these two line?

If you don't understand that, then I fear you need to start here.

Winston
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!