*
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help on Java modifications" Watch "Help on Java modifications" New topic
Author

Help on Java modifications

Troy Johnson
Greenhorn

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
Bartender

Joined: Aug 20, 2001
Posts: 1817

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
 
wood burning stoves
 
subject: Help on Java modifications
 
Similar Threads
More help on java modifications
palindrome not very proficient...
Palindrome
how to check whether a word is a palindrome
while loop