Can you access the private method from outside the class? Anonymous User135501-May-2015javajava reflection Updated on 18-Sep-2020
Anonymous User
01-May-2015You can call the private method from outside the class by changing the runtime behaviour of the class.
By the help of java.lang.Class class and java.lang.reflect.Method class, we can call private method from any other class.
Example:
A. java
Method.java
Output:hello java