首页 > 技术文章 > Intellij IDEA中如何给main方法赋args

sinceForever 2018-02-19 20:43 原文

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:运行结果:

 

 

 

 

推荐阅读