首页 > 其他 > 详细

产生随机数

时间:2015-11-02 23:02:47      阅读:189      评论:0      收藏:0      [点我收藏+]

package t9;

import java.util.Random;

import javax.swing.JOptionPane;

public class t9 {

public static void main(String[] args)
{


int []a=new int[10];
int i,k=0;
for(i=0;i<10;i++)
{
Random random1= new Random();
a[i]=random1.nextInt(100);
k=k+a[i];
}
String x=new String();
for(i=0;i<10;i++)
{
x=x+" "+a[i];
}
x=x+"\n和为"+k;
JOptionPane.showMessageDialog( null, x,
"Demonstrating String Class Constructors",
JOptionPane.INFORMATION_MESSAGE );

}

}

产生随机数

原文:http://www.cnblogs.com/love-xi/p/4931389.html

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