java 101, how do I count the number of arguments passed into main?

Viewed 46435

For example

public static void main(String[] args) {
            int count = 0;
        for (String s: args) {
            System.out.println(s);
                count++;

        }

    }

is there some way of doing something like

int count = args.length()? or args.size()?

6 Answers
Related