Working with the class keyword in Java

后端 未结 8 1315
梦毁少年i
梦毁少年i 2021-02-13 19:16

I don\'t really understand how the class keywords work in some instances.

For example, the get(ClientResponse.class) method takes the Cl

8条回答
  •  甜味超标
    2021-02-13 19:46

    SomeClass.class
    

    returns a Java Class object. Class is genericized, so the actual type of SomeClass.class will be Class .

    There are lots of uses for this object, and you can read the Javadoc for it here: http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html

提交回复
热议问题