[Java method learning] command line parameter transfer

Command line parameter transfer

Pass a message to it when running a program. This is achieved by passing command line parameters to the main() function.

public class Demo03 {
    
    
    public static void main(String[] args) {
    
    
        for (int i =0;i<args.length;i++){
    
       //args.length表示数组长度
            System.out.println("args["+i+"]:"+args[i]);
        }
    }
}
Pay attention to the steps

Insert picture description here
Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_44302662/article/details/114678801
Recommended