<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 23,comments - 12,trackbacks - 0


    1、Message.java
    public class Message {

     public static void main(String[] args) {
        if (args[0].equals("-h"))
              System.out.print("Hello,");
           else if (args[0].equals("-g"))
              System.out.print("Goodbye,");
           // print the other command line arguments
           for (int i = 1; i < args.length; i++)
              System.out.print(" " + args[i]);
           System.out.println("!");

     }
    }

    test:
    java Message -g cruel world



    import java.util.*;
    import javax.swing.*;
    public class FirstSample {

     public static void main(String[] args) {
           String input = JOptionPane.showInputDialog
              ("How many numbers do you need to draw?");
           int k = Integer.parseInt(input);

           input = JOptionPane.showInputDialog
              ("What is the highest number you can draw?");
           int n = Integer.parseInt(input);

           // fill an array with numbers 1 2 3 . . . n
           int[] numbers = new int[n];
           for (int i = 0; i < numbers.length; i++)
           {    numbers[i] = i + 1;
           System.out.println(numbers[i]);
           }
           // draw k numbers and put them into a second array

           int[] result = new int[k];
           for (int i = 0; i < result.length; i++)
           { 
              // make a random index between 0 and n - 1
              int r = (int)(Math.random() * n);

              // pick the element at the random location
              result[i] = numbers[r];

              // move the last element into the random location
              numbers[r] = numbers[n - 1];
              n--;
           }

           // print the sorted array

           Arrays.sort(result);
           System.out.println
              ("Bet the following combination. It'll make you rich!");
           for (int i = 0; i < result.length; i++)
              System.out.println(result[i]);

           System.exit(0);

     }
    }

    posted on 2005-09-05 10:51 my java 閱讀(213) 評論(0)  編輯  收藏

    只有注冊用戶登錄后才能發(fā)表評論。


    網(wǎng)站導航:
     
    主站蜘蛛池模板: 黄页网站免费观看| 最近中文字幕完整免费视频ww| 青青青国产在线观看免费| 亚洲va久久久噜噜噜久久| 青柠影视在线观看免费| 免费在线人人电影网| 国产一区二区三区免费在线观看| 亚洲国产精品无码久久九九大片| 久久WWW色情成人免费观看| 亚洲av片不卡无码久久| v片免费在线观看| 久久精品毛片免费观看| 中文字幕亚洲第一在线| 成年人网站免费视频| 香蕉大伊亚洲人在线观看| 日韩中文无码有码免费视频| 亚洲AV色欲色欲WWW| 91香蕉国产线在线观看免费| 亚洲精品第一国产综合精品| 免费AA片少妇人AA片直播| 亚洲另类无码一区二区三区| 可以免费观看的一级毛片| 成在线人免费无码高潮喷水| 亚洲天堂中文资源| 亚洲天堂免费在线| 老子影院午夜伦不卡亚洲| 亚洲狠狠婷婷综合久久久久| 四虎在线视频免费观看视频| 337p日本欧洲亚洲大胆人人| 亚洲中文久久精品无码| 国产精品亚洲专区一区| 色久悠悠婷婷综合在线亚洲| 最近在线2018视频免费观看| 亚洲av无码一区二区三区天堂| 国产AV无码专区亚洲AV漫画 | 亚洲精品动漫人成3d在线| 免费萌白酱国产一区二区三区| 亚洲宅男天堂a在线| 亚洲?v女人的天堂在线观看| 88av免费观看入口在线| 羞羞漫画小舞被黄漫免费|