Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要为此程序初始化一个常量 int,但它给了我错误“令牌“NO_VALUE”上的语法错误,删除此令牌”,但“NO_VALUE”应该是 int 的名称。
这是我尝试初始化它的代码
public class DayOfWeek { int myMonth, myDayOfMonth, myYear, myAdjustment, numericDayOfWeek; public final int constant NO_VALUE = -1;
删除无效constant关键字(并添加static)以生成常量
constant
static
public static final int NO_VALUE = -1;
查看可用的关键字
也看看这个答案