1. What is RTTI?
RunTime Type Identification (RTTI).
2 What's the RTTI used for?
To check the type of a object at runtime. It typically used in the following two situations:
(1) downcasting
(2)instanceof
3. The Class class.
• At compile time, Java creates the Class objects and stores them in .class files.
• At run time, when an object of a class is created for the first time, the JVM loads the Class object into memory.
• When the Class object of a given type is loaded, it is used to create any object of that type.