• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using multiple command line arguments to open multiple files

 
Jack Sloan
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys, I am trying to get the hang of CommandLine arguments and am trying to use two at a time say fro instance where I put two files in and I want my program to open both and collect statistics about it.
This is what I have.
How can I make it so two or more filenames can be added to this and then print out the results?
Thanks
 
Edwin Torres
Ranch Hand
Posts: 55
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Notice that the args parameter of main() is an array:

When you pass arguments in on the command line, they are placed into that args array. So if your command line is this:

java ProcessText one two three

Then your args array will look like this:

{ "one" , "two" , "three" }

 
Jack Sloan
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you I got it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic