Eclipse input command-line arguments

Source: Internet
Author: User

To enter command line arguments in eclipse, you can right-click on the program in the directory, select "Run as", select "Run Configurations",

Then enter the command line arguments:

Clicking Apply and run will pass the command-line arguments to our program.

public static void Main (string[] args) {     System.out.println (args[0]);     System.out.println (Args[1]);}

This will then be output on the console:
Test

A

Note that we simply separate the "a" and "test" with a space (no matter how many points are open), to ensure that they are not joined together and that the line is wrapped, and the program processes them into two different parameters.

Note:

Array element string type named Args with an array parameter of args[0] args[1] args[2] args[3] ... If you run in cmd, you can add parameters directly to the file name, and those parameters will be passed to the args array.

Http://www.cnblogs.com/wenjiang/archive/2013/01/12/2857765.html

Eclipse input command-line arguments

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.