开发者

How are anonymous classes compiled in Java?

开发者 https://www.devze.com 2023-02-28 22:32 出处:网络
I\'ve heard that Java 开发者_如何学Pythonbytecode actually doesn\'t support any kind of unnamed classes. How does javac translate unnamned classes to named ones?It synthesizes a name of the form Enclo

I've heard that Java 开发者_如何学Pythonbytecode actually doesn't support any kind of unnamed classes. How does javac translate unnamned classes to named ones?


It synthesizes a name of the form EnclosingClass$n, where "n" is a counter for anonymous classes in EnclosingClass. Because using $ in identifiers is discouraged, these names should not collide with any user-specified names.

0

精彩评论

暂无评论...
验证码 换一张
取 消