What will be the name of the .class file when local classes with same name are present in more than one instance method of same class? How can JVM differentiate these local classes?
Share
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.
With both local classes and anonymous classes the compiler adds a number to the generated name.
Compiling the below code produced classes
Test.class,Test$1Local.class,Test$2Local.classandTest$1Another.classso the compiler (jdk1.6.0_24) always adds a number to the name (maybe to avoid conflicts with inner classes) and if there are two local classes with the same name then it increments the number to avoid conflicts.