日期:2014-05-20  浏览次数:25525 次

编译时报 not a statement 错
public boolean check_number(String s)
  {
  boolean flag = false;
  int i = Integer.parseInt(s);
  return true;
  NumberFormatException numberformatexception;
  numberformatexception;
  return false;
  }
编译时报 numberformatexception; not a statement 错。

------解决方案--------------------
好象大概知道你要的结果和功能:
改下:
public boolean check_number(String s) 

boolean flag = false; 
try{
int i = Integer.parseInt(s); 
}catch(NumberFormatException e){
return false;
}
return true; 

应该就是捕获这个异常去判断是否是数字吧4
------解决方案--------------------
1楼有道理
------解决方案--------------------
numberformatexception是一个类,它会产生的是对象,他当然不是STATE(语句块了),仿照一楼的捕抓就行了