Import java.util.arrays;/** * This is a test class, used to study the value of the main method of the problem * @author HHB */public class Test {/** * This is the main method of the class, to accept the user's input, and to save the input data to the An array of type String * @param args */public static void main (string[] args) {System.out.println (arrays.tostring (args));// Print output Array object data in Args}}
The above is a piece of Java code I wrote that implements the parameter to the main method and prints it out. I'll show you how to pass the parameters to the Main method:
First step: As shown, click the drop-down triangle referred to by the Red arrow and select "Run Configurations" in the list of menu items
650) this.width=650; "Src=" http://img.blog.csdn.net/20170308203235873?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvr09prf9dt0rfug==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/ Center "width=" 487 "height=" "border=" 0 "hspace=" 0 "vspace=" 0 "title=" "style=" width:487px;height:70px; "alt=" Center "/>
Step Two: Follow the steps shown, and then run the program to see the results
650) this.width=650; "Src=" http://img.blog.csdn.net/20170308203659129?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvr09prf9dt0rfug==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/ Center "alt=" center "/>
Step Three: View the print results in the console and find the parameters passed in as an array in the second step
650) this.width=650; "Src=" http://img.blog.csdn.net/20170308201425176?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvr09prf9dt0rfug==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/ Center "alt=" center "/>
Note: I am using the Eclipse version: Juno Service Release 2, the steps may vary slightly depending on the version of the software being used.
This article is from the "Shan Haibo blog" blog, make sure to keep this source http://hhb96.blog.51cto.com/8222007/1918266
How eclipse passes arguments to the main method