wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes how to handle a NULL args[] value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how to handle a NULL args[] value" Watch "how to handle a NULL args[] value" New topic
Author

how to handle a NULL args[] value

bob connolly
Ranch Hand

Joined: Mar 10, 2004
Posts: 204
Hello!

When passing in a long string of args[] values, if the DBO value is NULL, it shifts the whole lineup of args[] values in by 1 position!

Is there a better way to handle NULL args[] values or is there a better way to pass a large list of args[] values into a Java program?

Thanks much!
bc

David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
You can quote the arguments so they show up as empty strings when they have no value.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9052
    
  12
You could do a check at the beginning of the app to verify that you have the correct number of args passed in.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
If some arguments are optional, you can use a flag (like -d) to indicate that the next argument is the optional argument.

Layne


Java API Documentation
The Java Tutorial
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to handle a NULL args[] value