JAVA第三周随笔

方法一:
import java.util.Scanner;

public class proj {
public static void main(String[] args) {
int sum=0;
int a;
Scanner sr = new Scanner(System.in);
sr.useDelimiter("\s"); //间隔模式为空格
while(sr.hasNextInt()){
a=sr.nextInt();
sum+=a;
}
System.out.println("和为"+sum);
sr.close();
JOptionPane.showMessageDialog(null,sum,"和为:",
JOptionPane.PLAIN_MESSAGE); }

	}
}

方法二:
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner kbintput = new Scanner(System.in);
int sum=0;
String s= kbintput.nextLine();
String[] array=s.split("\s{1,}"); //{1,}表示1个数以上
for(String tmp:array){
int a=Integer.parseInt(tmp); //转换成整数类型
sum+=a;
}
kbintput.close();
JOptionPane.showMessageDialog(null,sum,"和为:",
JOptionPane.PLAIN_MESSAGE); }
}

本学期期末选题为:视频播放器
主要播放WAV格式的动画,(即用Flash做出的动画)。
动画来源:信息学院Flash艺术创作协会
最后将做好的视屏播放器运用到信息学院Flash艺术创作协会网页上。

posted @ 2016-03-27 18:14  软一2014330104陈旭东  阅读(137)  评论(0编辑  收藏  举报