mercredi 24 juin 2015

Passing an instance of type Class instead of the class represented by Class

Let us say there is a class X. Then, the following line returns an instance of Class which represents X

Class c = X.class;

Assume there is a method foo()

public void foo(X x){.....}

Is it legitimate to do

foo(c);





Aucun commentaire:

Enregistrer un commentaire