Home > DeveloperSection > Interviews > What is reflection in Java ?

Posted on    July-04-2015 12:28 AM

 Java Java  Reflection 
 1 Answer(s)
  499  View(s)
Rate this:

Mayank Tripathi
Mayank Tripathi

Total Post:807

Posted on    July-04-2015 12:28 AM

If a programmer wants to access entities or invoke methods in a program dynamically, i.e. if the programmer is unaware of the methods and variables that needs to be invoked at runtime but unaware of it while coding, we can use reflection. For example
Method method = ABC.getClass().getMethod("doSomething", null);
method.invoke(ABC, null);

Don't want to miss updates? Please click the below button!

Follow MindStick