<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)站導航:
     
    主站蜘蛛池模板: 9久热精品免费观看视频| 99久久人妻精品免费一区| 成人免费无码视频在线网站| 免费看美女让人桶尿口| 亚洲婷婷国产精品电影人久久| 亚洲.国产.欧美一区二区三区| 免费在线观影网站| 亚洲欧洲美洲无码精品VA| 亚洲H在线播放在线观看H| 四虎精品成人免费视频| 亚洲免费一级视频| 国产亚洲精品国产| 欧洲亚洲国产精华液| 国产一区在线观看免费| 一区二区三区免费电影| 亚洲阿v天堂在线| 亚洲国产精品免费在线观看| 亚洲成A∨人片天堂网无码| 一区二区免费电影| 亚洲av日韩av无码| 我的小后妈韩剧在线看免费高清版| 国产成人A亚洲精V品无码 | 久久久久久久岛国免费播放 | 久久国产高潮流白浆免费观看| 亚洲人成影院在线无码观看| 国产一级在线免费观看| 亚洲男人天堂2020| 亚洲精品免费视频| 亚洲欧洲日本在线观看| 在线看片韩国免费人成视频| 亚洲国产成人私人影院| 中国一级全黄的免费观看| 久久水蜜桃亚洲av无码精品麻豆| 毛片在线看免费版| 一区二区三区在线观看免费| 亚洲综合一区二区精品导航| 国产精品嫩草影院免费| 日本亚洲欧美色视频在线播放| 亚洲无线观看国产精品| 午夜性色一区二区三区免费不卡视频 | 亚洲中文字幕一二三四区|