Solved

finding the number of arguments passed in through the command prompt

Posted on 2001-07-05
1
212 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
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 will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This video teaches viewers about errors in exception handling.

760 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

22 Experts available now in Live!

Get 1:1 Help Now