关于StreamTokenizer的错误?
import java.io.*;public class Token
{
public static void main(String[] args) throws IOException
{
BufferedReader br = new BufferedReader(
new FileReader("person.txt"));
BufferedWriter bw = new BufferedWriter(
new FileWriter("token.txt"));
StreamTokenizer st =new StreamTokenizer(br);
int tokenType;
st.whitespaceChars(0,32);
st.eolIsSignificant(true);
while (br.ready())
{
tokenType = st.nextToken();
switch(tokenType)
{
case st.TT_NUMBER:
{
bw.write(String.valueOf((long)st.nval));
bw.newLine();
break;
}
case st.TT_WORD:
{
bw.write(st.sval);
bw.newLine();
break;
}
default:
;
}
}
bw.close();
}
}
这是我的程序,为什么总是报“需要常量表达式 case st.TT_NUMBER”错误,请知道的指点一下!!