I don\'t really understand how the class
keywords work in some instances.
For example, the get(ClientResponse.class)
method takes the Cl
Here ClientResponse.class
is an instance of Class
. In general Class
object represents type of an object. When you create new instance:
Object obj = new ClientResponse()
you can retrieve the class (type) of that object by calling:
obj.getClass()
So, why would you pass Class
objects around? It's less common, but one reason is to allow some method create arbitrary number of instances of a given class:
ClientResponse resp = ClientResponse.newInstance();