import java.io.*;
public class numbertest
{
public numbertest() {}
public static void main(String args[]) throws Exception {
int port;
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
while(true){
System.out.println("please input a number: ");
try
{
port =Integer.parseInt(in.readLine());
System.out.println("yeah,you input: "+port);
break;
}
catch (NumberFormatException e)
{
System.err.println("number error");
}
}
System.out.println("press any key to quit.");
String quit=in.readLine();
if(quit!=null){
System.exit(1);
}
}
}
public class numbertest
{
public numbertest() {}
public static void main(String args[]) throws Exception {
int port;
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
while(true){
System.out.println("please input a number: ");
try
{
port =Integer.parseInt(in.readLine());
System.out.println("yeah,you input: "+port);
break;
}
catch (NumberFormatException e)
{
System.err.println("number error");
}
}
System.out.println("press any key to quit.");
String quit=in.readLine();
if(quit!=null){
System.exit(1);
}
}
}
解决方案 »
- 我想实现一个功能:从控制台输出一个正三角形,一个倒三角形,和一个菱形
- 怎样将"L_LIST":"id""name""L_LIST":"id""name""L_LIST":"id""name""L_LIST":"id""name"解
- 定义变量的问题
- 如何以追加的方式写zip文件
- 有没有人知道javax.jts包在哪啊?
- 在线等,关于MD5加密中文不一致问题
- 请问如何用java调用oracle函数
- 各位高人,谁知道怎样将Java代码编译成本地的二进制代码
- 用JBuilder7,存盘的时候会莫名其妙的多出以~为内容的零时文件,如何关掉这个功能?
- 关于java对象的声明和实例对象的引用和类型的强制转换问题
- 怎么用java类?
- 关于JDBC简单的问题...
MM,GG来晚了,帮你顶一下