Solved

finding the number of arguments passed in through the command prompt

Posted on 2001-07-05
1
218 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Tomcat: Unable to run tomcat service. 2 34
Is Applet the way to go for my drag and drop system? 8 51
glassfish admin console 1 53
batch vs regular insert in spring DAO 2 52
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

751 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