作业三
import java.util.Scanner;
public class TestScanner {
/**
* @param args
*/
public static void main(String[] args){
//TOOD Auto-generated method stub
/*int nextValue;
Scanner kpInput = new Scanner(System.in);
nextValue = kpInput.nextInt();
System.out.println("读取:" + nextValue);
kpInput.close();
从键盘读取若干整数并读取输出*/
int nextValue, sum = 0;
Scanner kpInput = new Scanner(System.in);
while(kpInput.hasNextInt()){
nextValue = kpInput.nextInt();
sum += nextValue;
System.out.println(nextValue);
}
kpInput.close();
System.out.println("Sum: " + sum);
}
}