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.
精彩评论