| Author |
Argument, passing a textfile
|
Keshan Pillay
Greenhorn
Joined: May 21, 2008
Posts: 29
|
|
Hey everyone! I have to make a postfix calculator, and I think i'm pretty sorted as to the code for it. However, something that confuses me is: I use textpad to do my editing, compiling etc. I've been told I need to pass a textfile, as an argument? Or I'm just confused... How do I do this? I think its something to do with run parameters. Many Thanks Keshan Pillay
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32827
|
|
Difficult to be sure, but I think it might refer to a command line argument. You write java PostfixCalc "1 2+ 3*" The structure of your main method requires the "" otherwise it would only recognise 1. You cannot join the arguments together and maintain postfix nomenclature, otherwise it would read 12+3* or 123+4* which is ambiguous.
|
 |
Keshan Pillay
Greenhorn
Joined: May 21, 2008
Posts: 29
|
|
|
Thanks for the reply! I got it sorted! turns out I had to make a file I/O method, because the calculations were in a text file, and then pass the textfile as an argument through the command prompt.
|
 |
 |
|
|
subject: Argument, passing a textfile
|
|
|