Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

public class Main {
    public static void main(String[] args) {

        Class cls;
        cls = (new MyObject()).ClassAObject().getClass();

        System.out.print("Method = ");
        System.out.println(cls.getEnclosingMethod());
    }
}

class MyObject {

    public Object c;

    public MyObject() {
        class ClassA {
        }
        ;
        c = new ClassA();
    }

    public Object ClassAObject() {
        class ClassA {
        }
        ;
        return new ClassA();
    }

}