title: How to count number of arguments?
body: <p>Can any one tell me how can I count number of arguments in java.</p>
  
  <p>I am using log4j and below is the code I am using but still I see that my code stucks at length =0 . Any help?</p>
  
  <pre><code>public static void main(String args[]) throws RemoteException{
  
    log.info("running Example1");
  
    String sfUrl = "https://ca...ov";
    String sfUser ="...";
    String sfPass ="...";
  
    log.error(args.length);
  
  
  
    if (args.length != 3)
    {
       log.error("Usage: teamforge-url username password");
    }
    else
    {
       sfUrl  = args[0];
       sfUser = args[1];
       sfPass = args[2];
  </code></pre>