<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)  編輯  收藏

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


    網站導航:
     
    主站蜘蛛池模板: 精品免费视在线观看| 99在线精品视频观看免费| 一日本道a高清免费播放| 99久久免费国产特黄| 成人免费观看一区二区| 亚洲宅男永久在线| 3344永久在线观看视频免费首页| 亚洲精品国产品国语在线| a毛片免费全部播放完整成| 亚洲日韩一页精品发布| 免费毛片在线看不用播放器| 一区二区三区亚洲| 野花高清在线电影观看免费视频| 亚洲女同成av人片在线观看 | 亚洲人成无码网站| a毛片全部免费播放| 亚洲网站在线观看| 苍井空亚洲精品AA片在线播放 | 午夜免费福利视频| 亚洲熟妇av一区二区三区下载| 七次郎成人免费线路视频| 久久久久亚洲精品中文字幕| 你懂的在线免费观看| 久久久久久亚洲Av无码精品专口| 69成人免费视频| 国产亚洲精品免费| 成熟女人牲交片免费观看视频| 亚洲一区二区三区在线观看网站| 免费无码又爽又刺激高潮视频| 久久精品亚洲AV久久久无码| 日韩内射激情视频在线播放免费| 亚洲人成网站在线观看播放动漫| 丁香花在线视频观看免费| 亚洲国产人成在线观看| 啊灬啊灬别停啊灬用力啊免费看| a级毛片在线视频免费观看| 亚洲一级毛片免费看| 亚洲国产成人精品久久久国产成人一区二区三区综 | 亚洲国产情侣一区二区三区| 国产免费人成视频在线观看| 亚洲精品无码国产片|