StreamTokenizer からトークンを返す必要がある stringtoList ArrayList がありますが、実行時に s.sval がコンパイルされていません。この問題について誰か助けてください。
private List<Token> stringToList(final String string) {
// TODO your job
// follow Main.main but put the tokens into a suitable list
ArrayList<Token> al = new ArrayList<Token>();
String word = "";
String in = string;
StreamTokenizer s = new StreamTokenizer(new StringReader(in));
int token;
while ((token = s.nextToken()) != StreamTokenizer.TT_EOF) {
if (token == StreamTokenizer.TT_WORD) {
DefaultToken t = (s.sval, s.lineno()); //problem here, not reading the sval from the StreamTokenizer!!!
al.add(t);
}
return al;
}
}
どんな助けでも大歓迎です