dimanche 10 juin 2018

Does calling Object.getClass() itself use Reflection?

My understanding is that java.lang.Class is the "entry point for all reflection operations". I also understand that when you instantiate a new object it will load the object's class if it's the first time it's needed.

Something something = new Something() 

Does calling Object.getClass(), or in our case something.getclass(), use reflection or is it just the methods inside Class itself that use reflection?

I would think that something.getClass() does not use reflection due to the fact that the Class's reference has been loaded and getClass would just be a getter for this reference, but I just want to make sure.





Aucun commentaire:

Enregistrer un commentaire