Re: How to read a string from the command line?
Posted By:
m_muruges
Posted On:
Friday, March 22, 2002 04:46 AM
hi,
you can get it from the String[] arg parameter in the main method.
see the following program.
class Command
{
public static void main(String arg[])
{
if (arg.length<1)
{
System.out.println("Usage: java Command name");
}
System.out.println("Your name is:"+arg[0]);
}
it will print ur name if you run the program as below
java Command majumder