The arguments which are passed through command line at run-time and which are stored in the array of string class in main method are called as command line arguments.


Write a program to pass command line arguments.
123456789101112131415161718class E
{
public static void main(String args[])
{
int n=args.length;
int i;
if(n>0)
{
for(i=0;i<n-1;i++)
System.out.println(args[i]);
}
else
{
System.out.println("Please enter values");
}
}
}
Post A Comment: