PDA

View Full Version : toString() in java



saneha
04-24-2011, 08:44 PM
plz give brief knowledge about toString() method, and also told that if we have two objects .i.e. s1 and s2, then you call the toString() method explicitly for s1, and why you not call the toString() method for s2 explicitly, but implicity.

Vuhelper
04-24-2011, 08:44 PM
toString() can be called both implicitly and explicitly. The example is just to show that it can be called both implicitly and explicitly.


For s1 we have called ourself. And s2 toString() has been called automatically.