i am new to java and was already surprised some times. so maybe this is possible in java?
I have classes
class X {
string method_a(int x) {
String str="abc";
return str;
}
}
class Y {
void before(){};
void after(){};
}
Can i tell Java to call methods “before” and “after” of class Y before or after “method_a” of class X is called?
thanks
It sounds like you want Aspect-Oriented Programming. This isn’t something which exists as part of “normal” Java, but there are various technologies around to enable it in various ways. You might want to start with AspectJ.