Java abstract static Workaround

前端 未结 15 1986
猫巷女王i
猫巷女王i 2020-12-29 04:43

I understand that neither a abstract class nor an interface can contain a method that is both abstract and static because of ambiguity problems, but is there a workaround?

15条回答
  •  旧巷少年郎
    2020-12-29 05:22

    Is there a way to do this in Java?

    I don't think there is a way to do this in any language. There's no point to it, since static methods belong to a class and can't be called polymorphically. And enabling polymorphic calls is the only reason for interfaces and abstract classes to exist.

提交回复
热议问题