File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes number of arguments Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "number of arguments" Watch "number of arguments" New topic

number of arguments

rani bedi
Ranch Hand

Joined: Feb 06, 2001
Posts: 358
How can you count the number of command line arguments supplied at runtime?

Cheers,<br />Rani<br />SCJP, SCWCD, SCBCD
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Assuming your main method starts as follows..
public static void main(String args[])
The length of the args array should give you what you need.

So much trouble in the world -- Bob Marley
I agree. Here's the link:
subject: number of arguments
It's not a secret anymore!