About the “class” property/field

后端 未结 4 2196
后悔当初
后悔当初 2020-12-10 23:50

When you do:

MyClass.class.someMethod()

What exactly is the \"class\" field? I can\'t find it in the API docs. Is it an inherited static fi

4条回答
  •  情歌与酒
    2020-12-11 00:15

    The .class is not actually a field. You can think of is as more of an 'extension' like a file extension. It is a token used to differentiate the Class Object as opposed to an instance of the class.

提交回复
热议问题