bael-3208 command line arguments examples (#7704)

* bael-3208 command line arguments examples

* moved command line argument examples from core-java-lang to core-java-lang-2
This commit is contained in:
fanatixan
2019-09-03 18:26:21 +02:00
committed by maibin
parent c6b3e0316c
commit 06cbdfce02
6 changed files with 89 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
package com.baeldung.commandlinearguments;
public class CliExample {
public static void main(String[] args) {
System.out.println("Argument count: " + args.length);
for (int i = 0; i < args.length; i++) {
System.out.println("Argument " + i + ": " + args[i]);
}
}
}

View File

@@ -0,0 +1,12 @@
package com.baeldung.commandlinearguments;
public class CliExampleWithVarargs {
public static void main(String... args) {
System.out.println("Argument count: " + args.length);
for (int i = 0; i < args.length; i++) {
System.out.println("Argument " + i + ": " + args[i]);
}
}
}