Android or Java class naming with $ symbol

后端 未结 2 1589
旧时难觅i
旧时难觅i 2021-02-19 10:51

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



        
相关标签:
2条回答
  • 2021-02-19 11:02

    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

    0 讨论(0)
  • 2021-02-19 11:05

    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 讨论(0)
提交回复
热议问题