| |
技术文档>>JAVA>>新手入门>>基础入门>查看文档 |
|
| |
java 中如何象在c里面的scanf那样输入 int 型整数 |
|
| |
文章作者:未知 文章来源:水木森林 |
|
| |
查看:95次 录入:管理员--2007-11-17 |
|
| |
import java.io.*; public class scanf{ public static void main(string[] args) { datainputstream din=new datainputstream(system.in); string str; int a=0; system.out.print("input the integer number:"); system.out.flush(); try{ str=din.readline(); a=integer.parseint(str); } catch (numberformatexception e) {} catch (ioexception e ) {} system.out.println("the number you input is:"+integer.tostring(a)); } }
|
|