String Conversion and toString() in Java
by, 04-26-2012 at 07:30 PM (275 Views)
When data is converted into string representation while concatenation is done, versions that are overloaded string conversion methods valueOf() are called. They are defined by the help of String.valueOf(), which are overloaded for type Object and all simpler types. In case of simple types, a string is returned by the valueOf() in which human readable are present that are equal to value that has been called. On the object, toString() method is called by ValueOf(). Here toString() method shall be examined as it will be determining the objectís string representation for the created classes.
toString() is implemented by each class as object defines it. Tostring() default implementation is sufficient. Override toString() for those classes which are created to provide string representations of your own. This is easily done fortunately. General form of toString() method is as following:
String toString( )