Hi All, I have a situation here... say there are two classes Test1.java and Test2. java I want to find the classs[es] which created the Test2 object. Is it possible to find this from ClassLoader etc.,?
It is quite simple, but you have to change your code:
Notice that the Creator passes itself in the constructor to the created object. Now Created can have access to its Creator through the "myCreator" variable. Another point is that you can't do this from a static method (public static void main) because "this" is not defined. However, if you only care about the class of the creator, you can do something like this:
Good luck, Geoffrey [ March 01, 2004: Message edited by: Geoffrey Falk ]
Sun Certified Programmer for the Java 2 Platform
posted 15 years ago
Thanks for the reply Geoffrey... But the problem is I cannot change class Test1. I have the accessiblity to make modifications only in Test2.