Connecting Tech Pros Worldwide Help | Site Map

(Hopefully) simple java question

Steel546's Avatar
Newbie
 
Join Date: Mar 2009
Posts: 17
#1: Oct 1 '09
If I'm using a command line argument using args[0] and trying to pass it to a method with 2 parameters, is there a special way to do so?

basically it's

Expand|Select|Wrap|Line Numbers
  1. public static void main(string[] args) {
  2.  
  3. methodName("where i need args[0] to pass to", "C:\\testdoc.txt");
  4.  
  5. }
  6.  
  7. public static void methodName(string[] args, copyDocName){
  8.  
  9. code
  10. }
  11.  
Or am I going about this the wrong way?
Lives Here
 
Join Date: Sep 2006
Posts: 12,070
#2: Oct 1 '09

re: (Hopefully) simple java question


Java is case sensitive String[] != string[].
As to your question, you are making very little sense. If you have tried some code then post what you tried and the error message that you got.
Frinavale's Avatar
Site Moderator
 
Join Date: Oct 2006
Location: The Great White North
Posts: 5,066
#3: Oct 2 '09

re: (Hopefully) simple java question


What are you trying to say? I don't understand.

You can retrieve the value at args[0] and pass it to another method....
You can even pass the args array to another method....
Reply