You'd use the reflection API: First, use Class.getMethod to retrieve a Method objects for "showI", then use its invoke method to call the actual method with the object oo as parameter.
Make sure "oo" is a reference to an object of type "a", not of type "Object".
It would be helpful to read the javadocs of the Class class (and the associated classes Field and Method), so that you get a feeling for all the things the reflection API can do. [ July 03, 2007: Message edited by: Ulf Dittmer ]
Joined: Jan 18, 2007
Thank you Sir, But I dont know how will i apply this in my mentioned program... Can you help me please?
Joined: Mar 22, 2005
There's not much to help with: create an instance of "a" (you already have that - almost), use the getMethod method of the Class object for class "a" to obtain a Method object for the showI method, and then call the "invoke" method of that Method object to actually run the method.
Which of these steps are you having difficulty with? Did you read the javadocs? [ July 03, 2007: Message edited by: Ulf Dittmer ]