开发者

Android or Java class naming with $ symbol

开发者 https://www.devze.com 2023-02-15 12:38 出处:网络
I\'m reviewing a certain project and I see that there are many classes with the same name, but with a dollar ($) symbol at the end + increasing number. For example

I'm reviewing a certain project and I see that there are many classes with the same name, but with a dollar ($) symbol at the end + increasing number. For example

Class.ja开发者_StackOverflow社区va
Class$1.java
Class$2.java
Class$n.java
OtherClass.java
OtherClass$1.java
OtherClass$n.java

What does it mean?


AFAIK if it's has number it's an anonymous inner class, if it has a name after $ sign it means just inner class.
Edit: More about how compiler handles you can see here


The dollar sign is used by the compiler for inner classes. I thought it would be strange to manually make classes/files with those names though: As far as I know it's a compiler thing.

0

精彩评论

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