I am solving a question where the requirement is that the program should allow the user to set a parameter with the -d command-line option. Does java provide any mechanism to pass argument with -d option? I couldn't find any so I am interpreting this as if the command line option value is -d, that means that user wants to enter the parameter next.
if ( args[0].equals("-d") )
{
parameter = args[0];
}
Is this right way to check that? Is there some better way to check whether user has entered -d
option? Does java provides some other mechanism for that?