Thanks in advance for the help!
I have a few classes that need to all include the same static block, like:
public class Class1 {
static {
changeState();
}
...
}
public class Class2 {
static {
changeState();
}
...
}
I currently have an abstract class that only includes the mentioned static block, and the others classes all extend the abstract class like:
public abstract class WithChangeState {
static {
changeState();
}
}
public class Class1 extends WithChangeState {
...
}
public class Class2 extends WithChangeState {
...
}
This doesn't "feel" like the right pattern. Are there other more elegant or correct ways to accomplish this?