首页 > 编程语言 > 详细

Java第三次作业

时间:2016-03-28 18:35:17      阅读:125      评论:0      收藏:0      [点我收藏+]
import java.util.Scanner;


public class TestScanner {
    public static void main(String[] args) {
         int nextValue;
         int sum = 0;
         Scanner kbIntput = new Scanner(System.in);
        kbIntput.useDelimiter("\\s");//设置分隔符
        while(kbIntput.hasNextInt())
         {
            nextValue = kbIntput.nextInt();
            sum+=nextValue;
         }
        kbIntput.close();
        System.out.println("Sum:"+sum);
    }
}

技术分享

Java第三次作业

原文:http://www.cnblogs.com/Mrsli/p/5329739.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!