Can any one explain why reflect class doesnt show its methods while object class show its methods?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can any one explain why reflect class doesnt show its methods while object class show its methods??

Reflection class in java

3rd Apr 2020, 4:10 PM
goutham thota
goutham thota - avatar
3 Answers
+ 3
Reflection in Java Reflection is an API which is used to examine or modify the behavior of methods, classes, interfaces at runtime. The required classes for reflection are provided under java.lang.reflect package. Reflection gives us information about the class to which an object belongs and also the methods of that class which can be executed by using the object. Through reflection we can invoke methods at runtime irrespective of the access specifier used with them. resource: https://www.geeksforgeeks.org/reflection-in-java/
3rd Apr 2020, 5:06 PM
BroFar
BroFar - avatar
+ 2
What do you mean by reflect class? Reflection is about retrieving meta information from an object at runtime about its class. If you are using obj.getClass(), it's retrieving class information from the object. In what manner are you referring to with "reflect class"?
3rd Apr 2020, 6:05 PM
David Carroll
David Carroll - avatar
+ 1
David Carroll I wonder if he was referring to TheĀ java.lang.reflect.MethodĀ class provides information about, and access to, a single method on a class or interface. which is how tutorialspoint describe it https://www.tutorialspoint.com/javareflect/java_reflect_method.htm
3rd Apr 2020, 6:20 PM
BroFar
BroFar - avatar