Kennywen
asked on
passing argument to java program
i know we can pass the value to java program like:
java MyProgram Hello
Then in the MyProgram:
if ( args.length == 1 )
{
String Greeting;
Greeting = args[0];
}
but my problem how can i pass the address to my program? E.g. No 2, Street 132, 53000, Malaysia.
The java will treat each space is a new argument rite?
thanks
java MyProgram Hello
Then in the MyProgram:
if ( args.length == 1 )
{
String Greeting;
Greeting = args[0];
}
but my problem how can i pass the address to my program? E.g. No 2, Street 132, 53000, Malaysia.
The java will treat each space is a new argument rite?
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
yes and yes :)
ASKER
if the command java MyProgram "I'm from" "No 2, Street 132, 53000, Malaysia" is not type in the console (command prompt) but is call by other program like C++ is't it will work too?
thanks
thanks
should do
ASKER
sorry for late giving point.
ASKER
like this the java will treat it as 1 argument???
then if i write java MyProgram "I'm from" "No 2, Street 132, 53000, Malaysia"
then the java will treat it as 2 arguments???
thanks