randominteger.java

来自「北京邮电大学牛导的 JAVA课件课件及相关资料」· Java 代码 · 共 21 行

JAVA
21
字号
import javax.swing.JOptionPane;public class RandomInteger {        public static void main(String[] args)     {        int rd,counter;        String output;        output = "the result is \n";        for (counter = 1; counter<= 20; counter++)        {            rd = 1+(int)(Math.random()*6);            output = output+ rd +" ";            if((counter %5)==0)                output= output+"\n";         }        JOptionPane.showMessageDialog(null,output,"random",JOptionPane.INFORMATION_MESSAGE);        System.exit(0);    }    }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?