没有实例的最终常量类比常量接口更好?

Kan*_*mar 2 java interface class constants

在阅读有关常量接口反模式时,我发现没有实例的最终常量类比常量接口更好.
请解释我怎么样?

public interface ConstIfc {
  public static final int constValue = 10;
}

public final class ConstClass {
  private ConstClass{}
  public static final int constValue = 10;
}
Run Code Online (Sandbox Code Playgroud)

如果必须在没有命名Ifc/Class名称的UtilClass中使用constValue,我们可以实现/扩展它们.但实现支持多重继承.那么如何更好地延伸?
注意:我能够理解静态导入.

Daw*_*ica 7

我认为这个论点是你不需要扩展OR实现一个常量类或接口,因为我们有静态导入.因此,如果您要使用静态导入,那么为常量创建一个类更符合类实际的概念,而不是接口.并使其成为最后一堂课,消除了应用反模式的诱惑; 也就是说,扩展或实现定义常量的类型.

但在实践中,我不认为使用哪种模式会产生太多差异.