我见过这样的例子:
public class MaxSeconds {
public static final int MAX_SECONDS = 25;
}
Run Code Online (Sandbox Code Playgroud)
并且假设我可以有一个Constants类来包装常量,声明它们是静态final.我几乎不知道Java,我想知道这是否是创建常量的最佳方法.
我正在学习Java,并且发现接口可以有字段,这些字段是public static和final.到目前为止,我还没有看到这些例子.这些接口常量的一些用例有哪些,我可以在Java标准库中看到一些吗?