Write a Java program that prints all the values given at command-line?
Program:
class A{
public static void main(String args[]){
for(int i=0;i<args.length;i++)
System.out.println(args[i]);
}
}
compile by > javac A.java
run by > java A sonoo jaiswal 1 3 abc
Output
sonoo
jaiswal
1
3
abc
Tags: Java program that prints all the values given at command-line
Program:
class A{
public static void main(String args[]){
for(int i=0;i<args.length;i++)
System.out.println(args[i]);
}
}
compile by > javac A.java
run by > java A sonoo jaiswal 1 3 abc
Output
sonoo
jaiswal
1
3
abc