idea---Set main method parameters

idea—Set main method parameters

One, write the program

public class Hel {
    public static void main(String[] args) {
        String s = args[0];                     //接收第一个参数
        int i = Integer.parseInt(args[1]);      //接收第二个参数:因为args默认是String类型
        System.out.println(s+i);
    }
}

Two, enter the parameters of the main method

1, the first step
Insert picture description here
2, the second step,
Insert picture description here
just run it
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_43288259/article/details/115004285