enum Token_Type{
ORIGIN,SCALE,ROT,IS,
TO,STEP,DRAW,FOR,FROM,
T,
SEMICO, L_BRACKET, R_BRACKET, COMMA,// 分隔符
PLUS, MINUS, MUL, DIV, POWER, // 运算符
FUNC, // 函数(调用)
CONST_ID, // 常数
NONTOKEN, // 空记号(源程序结束)
ERRTOKEN
}
public class Token {
Token_Type type;
String lexeme;
double value;
String mathfun;
}
public class scanner {
Token []TokenTab =
{ new Token(Token_Type.CONST_ID, "PI", 3.1415926, null),//The constructor Token(Token_Type, String, double, null) is undefined
new Token(Token_Type.CONST_ID, "E", 2.71828, null),
new Token(Token_Type.T, "T", 0.0, null),
new Token(Token_Type.FUNC, "SIN", 0.0, "sin"),
new Token(Token_Type.FUNC, "COS", 0.0, "cos"),
new Token(Token_Type.FUNC, "TAN", 0.0, "tan"),
new Token(Token_Type.FUNC, "LN", 0.0, "log"),
new Token(Token_Type.FUNC, "EXP", 0.0, "exp"),
new Token(Token_Type.FUNC, "SQRT", 0.0, "sqrt"),
new Token(Token_Type.ORIGIN, "ORIGIN", 0.0, NULL),
new Token(Token_Type.SCALE, "SCALE", 0.0, NULL),
new Token(Token_Type.ROT, "ROT", 0.0, NULL),
new Token(Token_Type.IS, "IS", 0.0, NULL),
new Token(Token_Type.FOR, "FOR", 0.0, NULL),
new Token(Token_Type.FROM, "FROM", 0.0, NULL),
new Token(Token_Type.TO, "TO", 0.0, NULL),
new Token(Token_Type.STEP, "STEP", 0.0, NULL),
new Token(Token_Type.DRAW, "DRAW", 0.0, NULL)
}
}
问问是哪里错了阿,java新手求助
java 枚举 类数组
------解决方案--------------------
默认的是没有参数的,你要显式的提供构造函数