Intellij IDEA中如何给main方法赋args

Intellij IDEA中如何给main方法赋args

程序:

package com.otherExample;

/**
 * Created by 谭雪娇 on 2017/3/29.
 */
public class args {
    public static void main(String[] args){
        System.out.println(args.length);
        System.out.println(args[0]);
        System.out.println(args[1]);
    }
}

1:点击Edit configurations

 

2:配置Program arguments参数如图:传入多个参数使用换行符即可

 

3:运行结果:

 

原文地址:https://www.cnblogs.com/sinceForever/p/8454385.html