Solved

finding the number of arguments passed in through the command prompt

Posted on 2001-07-05
1
214 Views
Last Modified: 2011-09-20
How Do I get the Number of total arguments that is passed in at the command prompt.

example..

c:\java javaprogram first second third

I want it to return in this example 3 because there are three arguments.

Thank You.
0
Comment
Question by:selhamawy
1 Comment
 
LVL 5

Accepted Solution

by:
mattyk earned 50 total points
ID: 6257661
   public static void main (String args[]) {
        System.out.println(args.length);
    }

should do the trick


basically args.length is what you are looking for

-matty
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
groupNoAdj 7 85
topping3 challenge 14 70
firstChar challenge 13 107
reasons why a "inside Menu" would not appear for a web server 6 56
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now