Scanner cin=new Scanner(System.In); while(cin.hasNext()){ a=cin.nextInt(); b=cin.nextInt(); } 类似这样行不?