异常捕捉不到
这个程序是用来返回键盘输入的各种类型的数据项的方法
这是第一个文件,
package FormattedInput;
import java.io.*;
public class FormattedInput {
private int readToken( ) {
try {
ttype = tokenizer.nextToken( );
return ttype;
}catch(IOException e ) {
e.printStackTrace( System.err );
System.exit( 1 );
}
return 0;
}
public int readInt( ) throws InvalidUserInputException {
if( readToken( ) != tokenizer.TT_NUMBER ) {
throw new InvalidUserInputException( " readInt( ) faild ."
+ "Input data not numeric." );
}
if( tokenizer.nval > ( double ) Integer.MAX_VALUE ||
tokenizer.nval < ( double ) Integer.MIN_VALUE ) {
throw new InvalidUserInputException( " readInt( ) faild ."
+ "Input data not numeric." );
}
if( tokenizer.nval != ( double ) ( int ) tokenizer.nval ) {
throw new InvalidUserInputException( " readInt( ) faild ."
+ "Input data not numeric." );