13.命令行传递参数

命令行传递参数:
有时候你希望运行一个程序的时候再传递给它消息,这要靠传递命令行参数给main()函数实现。
 1 package com.duan.method;
 2 
 3 public class Demo03 {
 4     public static void main(String[] args) {
 5         //args.length 数组长度 
 6         for (int i = 0; i < args.length; i++) {//快捷键遍历数组:args.length.for
 7             System.out.println("args["+i+"]:"+args[i]);
 8         }
 9     }
10 }

所以在黑窗口实现:
 

猜你喜欢

转载自www.cnblogs.com/duanfu/p/12222282.html
今日推荐