| Top level nested class | Non static inner class | Local class | Anonymous class | |
| Declaration Context | As static class member | As non-static class member | In block with non-static context | In block with non-static context |
| Accessibility Modifiers | All | All | None | None |
| Outer instance | No | Yes | Yes | Yes |
| Direct Access to enclosing context | Static members in enclosing context | All members in enclosing context | All members in enclosing context + local final variables | All members in enclosing context + local final variables |
| Defines static or non-static members | Both static and non-static | Only non-static | Only non-static | Only non-static |
| Constructors | Yes | Yes | Yes | No |
| Can use extends or implements clauses? | Yes | Yes | Yes | No |
Saturday, 21 March 2009
Top-level and Inner Java Classes
Labels:
Top-level and Inner Java Classes
Functions Vs. Procedures
1. Function is mainly used in the case where it must return a value. Where as a procedure may or may not return a value or may return more than one value using the OUT parameter.
2. Function can be called from SQL where as procedure can not be called from the sql statements
3. Functions are normally used for computations where as procedures are normally used for executing business logic.
4. You can have DML (insert,update, delete) statements in a function. But, you cannot call such a function in SQL.
5. Function returns 1 value only. Procedure can return multiple values (max 1024).
6.Stored Procedure: supports deferred name resolution. Example while writing a procedure that uses table named tabl1 and tabl2 etc..but actually not exists in database is allowed only in during creation but runtime throws error Function wont support deferred name resolution.
7.Stored procedure returns always int by default zero. where as function return type could be scalar or table or table values
8. Stored procedure is precompiled execution plan where as functions are not.
9.A procedure may modify an object where a function can only return a value The RETURN statement immediately completes the execution of a subprogram and returns control to the caller.
Subscribe to:
Comments (Atom)