Is it possible to override a private method using reflection?
I know how to invoke a private method, and I know how to get or set the value of a private variable, but I want to override the method.
I want the main method in SubClass to print out 2, but it prints out 1.
I don't think this can be done through reflection.
If not, does anyone know of another way of doing it?
(Other than making SuperClass.getInt() protected, or copying and pasting the printInt() method into SubClass.)
I know how to invoke a private method, and I know how to get or set the value of a private variable, but I want to override the method.
I want the main method in SubClass to print out 2, but it prints out 1.
I don't think this can be done through reflection.
If not, does anyone know of another way of doing it?
(Other than making SuperClass.getInt() protected, or copying and pasting the printInt() method into SubClass.)