java第三次作业

import java.util.Scanner;

public class Practice {

public static void main(String[] args) {
	int nextValue;
	int sum = 0;
	Scanner kbInput = new Scanner(System.in);
	kbInput.useDelimiter("\s");//设置数据之间的分隔符号为空格

	while (kbInput.hasNextInt()) {
		nextValue = kbInput.nextInt();
		sum += nextValue;
	}
	System.out.println("Sum:" + sum);
            kbInput.close();// 读完后关闭输入流对象
}

}

原文地址:https://www.cnblogs.com/shemai/p/5330082.html