oop - What is a "runtime class" in Java? -


i try understand object.getclass() method does.

the documentation says "returns runtime class of object." explanation doesn't me understanding term.

has simple description of "runtime class" , getclass() does?

just understand "an object has metadata of object's type". in object, can find methods declared in class, fields, type hierarchy, etc. information typically used code uses reflection either inspect objects/types or run method without need have class defined , compiled when they, being coded.

"runtime" may emphasized because class definition may change on time, or object may declared supertype while instance of subtype of 1 declared. when class loaded, it's information, loaded during instance, returned getclass() method.

in short, when code runs, vm have definition of class in different way "source" form type in .java file. information, of course after being compiled, loaded , metadata (as said above) constitute call "runtime class". it's fancy way "an object metadata class loaded when program running"


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -