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:
@@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user