finding the number of arguments passed in through the command prompt

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.
selhamawyAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
mattykConnect With a Mentor Commented:
   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
All Courses

From novice to tech pro — start learning today.