Originally posted by Kajol Shroff:
I totally agree to what u say....but i got confused because in Thinking in JAVA Bruce Eeckel has mentioned :
"System.out.println("source = " + source);
the compiler sees you trying to add a String object
( "source = " ) to a WaterSource. This doesn�t make sense to it, because
you can only "add" a String to another String, so it says "I�ll turn source into a String by calling toString( )!" After doing this it can combine the two Strings and pass the resulting String to System.out.println( ). Any time you want to allow this
behavior with a class you create you need only write a
toString( ) method. "
I got confused because of this statement......