Last active
October 6, 2019 14:01
-
-
Save alex-ber/5b7f24d4370057025fa0733e31197ef5 to your computer and use it in GitHub Desktop.
Get enclosing class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static class Bar { | |
public static void main(String[] args) { | |
Class<?> cl=new Object(){}.getClass().getEnclosingClass(); | |
System.out.println(cl==Bar.class); //will print true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment