COMMAND LINE ARGUMENT - COUNT

Sample Input (Command Line Argument) 1:
Command Arguments

Sample Output 1:

Arguments :
Command
Arguments
The number of arguments is 2

 

Sample Input (Command Line Argument) 2:
Commands

Sample Output 2:

Arguments :
Commands
The number of arguments is 1


CODE:

public class Main{

    public static void main(String[] args){         

        System.out.println("Arguments : ");

        for(int i=0;i<args.length;i++){

            System.out.println(args[i]);

        }

        System.out.println("The number of arguments is "+args.length);

        

    }

}


 

Comments

Popular posts from this blog