Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Argument, passing a textfile

 
Keshan Pillay
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 49761
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic