How to get implementation class name from an interface object ?
Joined: Feb 23, 2004
I am trying to debug an existing application. I have handle to a java object (say a.b.MyClass xyz). 'MyClass' is an interface. I want to know the name of the class which has implemented this interface. In other words, I want to know the actual type of a java object xyz. xyz.getClass().getName() returns the interface name and not the actual implementation class name. Is there a way to get the actual implementation class name ?
Thanks in advance!!
The greatest pleasure in life is doing what peoples say you can not do.
Joined: Mar 22, 2005
Yes, that's possible. You'd call ".getClass().getName()" on the object - that will return a String with the fully-qualified class name.