首页 > 其他 > 详细

第二次课中的一些问题

时间:2017-10-13 13:15:58      阅读:229      评论:0      收藏:0      [点我收藏+]

技术分享

源程序代码:

// RandomInt.java
// Shifted, scaled random integers
import javax.swing.JOptionPane;

public class RandomInt {
public static void main( String args[] )
{
int value;
String output = "";

for ( int i = 1; i <= 1000; i++ ) {
value = 1 + (int) ( Math.random() * 6);
output += value + " ";

if ( i % 5 == 0 )
output += "\n";
}

JOptionPane.showMessageDialog( null, output,
"1000 Random Numbers from 1 to 6",
JOptionPane.INFORMATION_MESSAGE );

System.exit( 0 );
}
}

程序结果截图:

技术分享

技术分享

输出后换行,比如:
System.out.println("a");
System.out.println("b");
结果:
a
b

第二次课中的一些问题

原文:http://www.cnblogs.com/andibier/p/7660443.html

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