Reflection api in Java
This question already has an answer here:
what is reflection in java?
Reflection makes it possible to inspect classes, interfaces, fields and methods at runtime, without knowing the names of the classes, methods etc. at compile time. It is also possible to instantiate new objects, invoke methods and get/set field values using reflection.
In which situation i need to use reflection?
mapping objects to tables in a database at runtime.
Real time scenarios and examples for the need of using reflection?
Good Real time example is MyEclipse IDE. if you put your mouse pointer over any class name it reflect the class name and with some information. This is also one type of reflection using reflection api.
Go through this Reflction API link you can get some more info.
链接地址: http://www.djcxy.com/p/47618.html上一篇: 反思:有效,真棒,必要的用途
下一篇: Java中的反射api