Accessing Methods and functions of a object whose class type is dynamically known
问题 I have an object A1 of type A. I dynamically find that out , that object A1 is of type A. I now have a property say "Name" which I want to access from A1 , how do I do it ? Now the biggest problem is that the object A1 can even be of type B. If it is of type B then I will have to obtain the value "Address". Now How I resolve this ? Below code does the type check , public static void testing(Object A1, String s) s - Classtype { try{ Class c = Class.forName(s); if( c.isInstance(A1)) // { //Now