Java abstract methods and interface implementation calls?

there are methods in the interface:

after()
before()
doInit()

when calling, I want to call the above three methods in this method by calling a method execute () . How should I design the class?

there are two ways of thinking now:

    Add a method to the
  1. interface: execute () , and call the above three methods during implementation.
  2. adds an abstract method, and then there is a excute () that also calls three.

personally, it seems better to use abstract methods, but I don"t know what"s good about it, or if there is a better design.

Thank you


if you need to call multiple times, select method 2. If you only call three methods once or twice, it is recommended that three methods be called directly


cannot be discussed in this way. The key depends on the original intention of the design of this API. How to locate this interface and what problems should be solved? Whether execute is a method of an interface, if so, it can be directly used as a method of an interface, if not, what is the scenario that execute is trying to solve

Menu