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

java 这个代码怎么一直都在运行不会出结果,哪里出问题了?
import java.io.*;//还有这个,编译时提示说“未使用导入”,why???????
 class SimpleInput 
 {
 static String readString(){ 
 BufferedReader br=new BufferedReader(new InputStreamReader(System.in),1);
 String string="";
 try{
string=br.readLine();

 }catch(IOException ex){
 System.out.println(ex);
 }  
 return string;
 }
public static int readInt(){
  return Integer.parseInt(readString());
}
}


class Test{
int x;
Test(int a){
  x=a;
   
}
void show(){
  System.out.println("X的逆序数为:");
  int s;
  while(x>0){
  s=x%10;
  x=x/10;
  System.out.print(x);
  }
}
}
  public class Te {

   
  public static void main(String[] args) {
  int value;
  value=SimpleInput.readInt();
  Test t=new Test(value);
  t.show();
  }
}


------解决方案--------------------
不会啊,有结果啊, 但是你得输入一个值啊
BufferedReader br=new BufferedReader(new InputStreamReader(System.in),1);

string=br.readLine();
 这里需要接受一个输入的值程序才会往下走