How private method will be called using reflection?

How private method will be called using reflection?
Answer
You can access the private methods of a class using java reflection package. … reflect package by passing the method name of the method which is declared private. Step2 − Set the method accessible by passing value true to the setAccessible() method. Step3 − Finally, invoke the method using the invoke() method.
 

Tìm kiếm

Back
Top