命令行参数
时间:2022-05-11 03:30
1 package first; 2 3 public class TestArgs { 4 5 public static void main(String[] args) { 6 if (args.length != 2) { 7 System.out.println("Error!"); 8 System.out.println("Length=" + args.length + "they are:"); 9 for (String s : args) 10 System.out.println(s); 11 } else { 12 for (String s : args) 13 System.out.println(s); 14 } 15 16 } 17 18 }
java classname args1 args2 //输入参数
命令行参数,布布扣,bubuko.com