I want to know that how can I invoke a private method from a class implementing a interface. Example:-
interface foo{
void method();
}
class myClass implements foo {
@Override
public void method(){}
private void methodInternal(){}
}
class someClass {
foo instan = new myClass();
}
Note that i dont have access to myClass(I Can't Cast To myClass becasue it is private class) but only have access to interface foo. Then how do i access method methodInternal() throught reflection. I Have This
foo service = someClass.instan;
// foo is actually a myClass then how do i access methodInternal
I wanna invoke method methodInternal after this. how Can I Do That
Aucun commentaire:
Enregistrer un commentaire