Return from boolean function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • abhishekbrave
    New Member
    • Dec 2007
    • 79

    #1

    Return from boolean function

    I want to return true and false from the function below, does this function will automatically returns true or I have to write return statement
    public boolean connection()
    {
    Hashtable env = new Hashtable(11);

    env.put(Context .INITIAL_CONTEX T_FACTORY,"com. sun.jndi.ldap.L dapCtxFactory") ;
    env.put(Context .PROVIDER_URL, "ldap://ad.infosys.com: 389");
    env.put(Context .SECURITY_AUTHE NTICATION, "simple");
    env.put(Context .SECURITY_PRINC IPAL, userid+"@ad.inf osys.com");
    env.put(Context .SECURITY_CREDE NTIALS,pwd);

    DirContext ctx = new InitialDirConte xt(env);

    ctx.close();
    }
  • karthickkuchanur
    New Member
    • Dec 2007
    • 156

    #2
    Originally posted by abhishekbrave
    I want to return true and false from the function below, does this function will automatically returns true or I have to write return statement
    public boolean connection()
    {
    Hashtable env = new Hashtable(11);

    env.put(Context .INITIAL_CONTEX T_FACTORY,"com. sun.jndi.ldap.L dapCtxFactory") ;
    env.put(Context .PROVIDER_URL, "ldap://ad.infosys.com: 389");
    env.put(Context .SECURITY_AUTHE NTICATION, "simple");
    env.put(Context .SECURITY_PRINC IPAL, userid+"@ad.inf osys.com");
    env.put(Context .SECURITY_CREDE NTIALS,pwd);

    DirContext ctx = new InitialDirConte xt(env);

    ctx.close();
    }
    u have return the value according to ur logic

    Comment

    • BigDaddyLH
      Recognized Expert Top Contributor
      • Dec 2007
      • 1216

      #3
      One quick way to check would have been to see if it compiles -- it won't. Did you try that first?

      Comment

      Working...