java第三次作业

 import java.util.Scanner;

public class Wangbo {
 /**
  * @param args
  */
 public static void main(String[] args) {
  // TODO Auto-generated method stub
        int nextValue,sum = 0;
        Scanner sr = new Scanner(System.in);
        sr.useDelimiter("\\s");
        while(sr.hasNextInt()){
        nextValue = sr.nextInt();
        sum += nextValue;
        }
        System.out.println("Sum = "+sum);
  
        sr.close();
 }
posted @ 2016-03-30 12:56  2014330321王博  阅读(89)  评论(0编辑  收藏  举报