我有以下枚举:为什么不将字节参数识别为整数?
public enum Months {
JAN(31),
FEB(28),
MAR(31),
APR(30),
MAY(31),
JUN(30),
JUL(31),
AUG(31),
SEP(30),
OCT(31),
NOV(30),
DEC(31);
private final byte DAYS; //days in the month
private Months(byte numberOfDays){
this.DAYS = numberOfDays;
}//end constructor
public byte getDays(){
return this.Days;
}//end method getDays
}//end enum Months
它给了我,说:“构造个月(INT)是未定义”虽然我通过一个有效字节的参数错误。 我在做什么错?
您传入整数,但您的构造函数需要字节 – u6f6o