Good morning all,
Hopefully a quick solution, I've done some reading up on taking command line
arguments and I almost have it licked, but I'm running into some trouble trying to
send into a method..
I'll give you an example of what I mean
Let's say I want to send 2 command line args into the program
the first argument args[0] will be a CHAR to select the method
and the second arguments args[1] would be the input data to run that method
How can I send args[1] into the methods (the methods being an int,double & string for required input) ?
I get an error if i call the method and try to directly send args[1]
I somehow need to parse the value first or something,
Am I close? :)
Help is always appreciated!
public static void main(String[] args)
{
if(args.length==2)
{
if(args[0].charAt(0) == 'a')
{
intMethod();
System.exit(0);
}
else if(args[0].charAt(0) == 'b')
{
doubleMethod();
System.exit(0);
}
else if(args[0].charAt(0) == 'c')
{
stringMethod();
System.exit(0);
}
}
}