Hi!

I think it can help you.

/**
* Prints the name of the class from a static context + the list of classes on the 
stack.
*/
public class StackTest {

    public static void main (String[] args) {
        Test test1 = new Test();
        System.out.println("\nClass name:\n" + ClassFromStatic.getMyClass().getName() 
+ "\n");
        Class[] classesOnStack = ClassFromStatic.getClassesOnStack();
        System.out.println("Classes on stack:");
        for (int i = 0; i <  classesOnStack.length; i++) {
            System.out.println(classesOnStack[i].getName());
        }
    }

    public static class ClassFromStatic extends SecurityManager{
        public static Class getMyClass(){
            return new ClassFromStatic().getClassContext()[1];
        }
        public static Class[] getClassesOnStack(){
            return new ClassFromStatic().getClassContext();
        }
    }
}


BR, 
don

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to