zhiyinjixu

  博客园  :: 首页  ::  :: 联系 ::  :: 管理

 

 

//B1.java
import java.io.*;

public class B1
{
public static void main(String[] args){
String str2 = new A1().check();
System.out.println(str2);
}
}



class A1 {
private String str1;
public String check(){
try
{
char ch;
BufferedReader buf;
buf=new BufferedReader(new InputStreamReader(System.in));
str1 = buf.readLine();
for (int i=0;i<str1.length();i++)
{
ch=str1.charAt(i);
if (!Character.isDigit(ch))
throw new NumberFormatException();
}

}catch(IOException e){
e.printStackTrace();
}catch(NumberFormatException e){
System.out.println("输入的参数不是数值类型");
}
return str1;
}
}



 

 

 

 

 

 

posted on 2012-01-06 18:47  zhiyinjixu  阅读(114)  评论(0)    收藏  举报