Command
line arguments are parameters supplied to the Main method at the time of
invoking it for execution. To understand the concepts see the example given
below:
Program
of Command line argument to accept name from the command line and writes to the
console.
using
System;
class
sample
{
public
static void Main( string[ ] args)
{
console.write("welcome
to");
console.write("
" +args[0]);
console.write("
" +args[l]);
}
}
Execution
for this program
C:\
> Sample My Home
Output
of Example
Welcome
to My Home
In
Previous examples, we have used the Main method with no parameters. Notice that
in the above example how the Main is declared.
No comments:
Post a Comment