• Post Reply Bookmark Topic Watch Topic
  • New Topic

Why does it print "ALL"  RSS feed

 
Esther Kak
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can somebody explain this.....Why does it print "ALL"

 
Andy Morris
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because toString() is automatically invoked by your System.out.println() invocation and since you overwrote that method it prints out 'ALL'.
 
Henry Wong
author
Sheriff
Posts: 23280
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The PrintStream's println() method that takes an Object, calls toString() to get a string object to print.

Henry
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!