June 14, 2024

JaiHoDevs

Java program that prints all the values given at command-line

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
Subscribe to get more Posts :