Command line Arguments Java

This program is for displaying the command line arguments in Java. This is a part of Mumbai University MCA Colleges Java programs

class Argu
{
public static void main(String args[])
{
int n=args.length;
System.out.println("Number of Arguments are="+ n);
System.out.println("The Arguments are=");
for(int i=0;i<n;i++)
 {
System.out.println(args[i]);
}
}
}

We use the argument passed in the command line to show them in the loop. The arguments are passed to the main() in the form of string


Hope this Program is useful to you in some sense or other. Keep on following this blog for more Mumbai University MCA College Programs. Happy Programming and Studying.

No comments:

Post a comment