| Author |
Why does it print "ALL"
|
Esther Kak
Ranch Hand
Joined: Oct 11, 2006
Posts: 51
|
|
Can somebody explain this.....Why does it print "ALL"
|
 |
Andy Morris
Ranch Hand
Joined: May 30, 2004
Posts: 78
|
|
|
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
Joined: Sep 28, 2004
Posts: 16689
|
|
The PrintStream's println() method that takes an Object, calls toString() to get a string object to print. Henry
|
Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
|
 |
 |
|
|
subject: Why does it print "ALL"
|
|
|