集册 Java实例教程 报告命令行参数的字典最小字符串

报告命令行参数的字典最小字符串

欢马劈雪     最近更新时间:2020-01-02 10:19:05

592
报告命令行参数的字典最小字符串

public class Main {

  public static void main(String[] args) {

    String minimum = args[0];
/** from n o w    j a v a  . c o m**/

    for (int i = 1; i < args.length; i++)

      if (minimum.compareTo(args[i]) > 0)

        minimum = args[i];


    System.out.println("Lexicographically minimum string is:" + minimum);

  }

}