Example usage for java.lang Class getEnclosingConstructor

List of usage examples for java.lang Class getEnclosingConstructor

Introduction

In this page you can find the example usage for java.lang Class getEnclosingConstructor.

Prototype

@CallerSensitive
public Constructor<?> getEnclosingConstructor() throws SecurityException 

Source Link

Document

If this Class object represents a local or anonymous class within a constructor, returns a java.lang.reflect.Constructor Constructor object representing the immediately enclosing constructor of the underlying class.

Usage

From source file:Main.java

public static void main(String[] args) {

    Class cls;
    cls = (new MyClass()).c.getClass();

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