how compiler knows about nested types like :
- Nested inner classes
- Anonymous class
- Nested Interface
…..etc
Need clearity…….
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Compiler extracts inner classes and creates separate
*classfile for each one. Inner class name is created asOuterClassName$InnerClassName. Anonymous inner classes do not have names, so their names are created asOuterClassName$1,OuterClassName$2, etc.Inner classes have special reference to instance of outer class using syntax
OuterClassName.this.Since inner classes are compiled into separate class files JVM does not deal with inner classes at all. It deals with regular classes that have “special” names described above.