readInt是InputStream提供的一个接口 最后由DataInputStream来实现 但是这个方法并不适合于从键盘输入 至于为什么不向多说了 请参考如下帖子: http://expert.csdn.net/Expert/topic/1395/1395003.xml?temp=.49107如果你想输入整数 一般使用如下代码BufferedReader in = new BufferedReader( new InputStreamReader(System.in) ); String s;try{ s = in.readLine(); int nInput = Integer.parseInt(s); }catch( IOException ex ){}
最后由DataInputStream来实现
但是这个方法并不适合于从键盘输入
至于为什么不向多说了
请参考如下帖子:
http://expert.csdn.net/Expert/topic/1395/1395003.xml?temp=.49107如果你想输入整数
一般使用如下代码BufferedReader in = new BufferedReader( new InputStreamReader(System.in) );
String s;try{
s = in.readLine();
int nInput = Integer.parseInt(s);
}catch( IOException ex ){}