public int countArguments( String args[] ) {

        logger.debug( "In countArguments(..)" );
                     
            String [] readArray= new String [10];
            for ( int i=0; i<readArray.length;  i++ ) {
                for(int count: readArray){ 
                 count=count+i;
                System.out.println( "Number of arguments = " + count );
                }
            }
        
    }

No need for such looops
args.length use this to display how many arguments were entered...

Thanks alot it is working now....

public void countArguments( String args[] ) {

        logger.debug( "In countArguments(..)" );
                     
        if ( args.length == 0 ) {

            System.out.println(
                    "No arguments were passed to this application" );
        }
        else {           

                System.out.println( "The number of arguments passed = " + args.length );
            
        }
            
    }

Mark thread as solved...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.