I'm not entirely sure what you are getting at here, but this is how toString() works :
The class Object has a toString() method which is :
Code:
// taken from the Sun src from SDK 1.4.1_02
public String toString() {
return getClass().getName() + "@" + Integer.toHexString(hashCode());
}
.. so basically the class name and the class hash code.
If you called this code on an abject that did not override the toString() method :
Code:
Object o = new Object();
String s = o.toString();
Your String s would contain something like "java.lanf.Object@ae5hh7".
Other objects may override the toString() method to output different info, eg :
Code:
public class MyClass {
public String toString() {
return "Hello, this is the toString() method overridden");
}
}
In this case, if you did this :
Code:
MyClass o = new MyClass();
String s = o.toString();
Your String s would contain "Hello, this is the toString() method overridden".
See ?!
--------------------------------------------------
Free Database Connection Pooling Software