How to get implementation class name from an interface object ?
shahabas shabeer
Ranch Hand
Joined: Feb 23, 2004
Posts: 49
posted
0
Hi friends,
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.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35257
7
posted
0
Yes, that's possible. You'd call ".getClass().getName()" on the object - that will return a String with the fully-qualified class name.