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.
instanceofbut rather Object.getClass(). @jameslarge I think that is what I was trying to figure out: If asking for the class from an object used reflection. Since an instance of the class has already been created when the object was first instantiated, did calling getClass just return the reference to the already created Class or if expensive reflection operations were taking place.java.lang.reflectAPI But so what? It does the same thing in either case. What is it that you are really trying to ask?