File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Help on Java modifications Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help on Java modifications" Watch "Help on Java modifications" New topic

Help on Java modifications

Troy Johnson

Joined: Sep 24, 2003
Posts: 20
Hello. I am working on the following Java problem. I am making two modifications to the program. The first is to Ignore cases, which I have completed. The second is to Use a command-line argument. Could anyone offer any suggestions on using a command-line argument with this program. Thanks.

[ October 11, 2003: Message edited by: Troy Johnson ]
[ October 11, 2003: Message edited by: Troy Johnson ]
Joel McNary

Joined: Aug 20, 2001
Posts: 1824

Command-Line arguments are easy to use. Take a look at the signature for the main method:

That String array is where you receive your parameters.
(As I learned in C, I call it argv[], instead of args...)
So, the length of this array will tell you how many parameters there are, and each parameter receives its own spot in the array.
Note that, unlike in C, the program name is not passed in here. The first parameter really is the first parameter.

Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
Try this
I agree. Here's the link:
subject: Help on Java modifications
It's not a secret anymore!