Declaring static generic variables in a generic class

前端 未结 4 621
难免孤独
难免孤独 2021-02-13 13:43

I\'ve read that you cannot declare static variables/methods inside a generic class and I really have no idea how to solve my problem or work around it so I ask for your guidance

4条回答
  •  星月不相逢
    2021-02-13 14:14

    according to http://download.oracle.com/javase/tutorial/java/IandI/abstract.html

    Class Members - An abstract class may have static fields and static methods. You can use these static members with a class reference—for example, AbstractClass.staticMethod()—as you would with any other class.

    But I haven't yet tested this myself

提交回复
热议问题