Eclipse : how we take arguments for main when run

后端 未结 4 1373
臣服心动
臣服心动 2020-11-27 21:25

In Java, for a normal main method :

public static void main(String[] args){
    // code here
}

String[] args is used to take s

4条回答
  •  执念已碎
    2020-11-27 22:23

    Right click the class. Then go to Run as > Run configurations. Select the program on the left side. Then on the arguments tab you will see Program Arguments. Enter your program arguments in this textarea, if you would like to pass multiple arguments separate the arguments by spaces.

    enter image description here

    This site provides a good step by step tutorial with images: http://www.javaprogrammingforums.com/java-jdk-ide-tutorials/362-how-send-command-line-arguments-eclipse.html

提交回复
热议问题