Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Diffrence between Method Declaration and Method definition

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 185
    Comment on it

    Hii ,friend's
    Today I will expain you about the diffrence between Method Declaration and method definition.
    In Method Declartion you can declare somthing like [public void my function();] here myfunction is the name of method. And In Method defintion you can put complete information like [public void emp();], in this emplyee method, you can put complete details like name , id, phone number etc. See the below examples it will clearly describe you the diffrence between Method Declaration and method definition.

    Step(1) Method Declaration-Method declaration is only declare a method name

    public void myfunction();  //method name myfunction
    

    Step(2)Method definition -A declaration that reserves storage (for data) or provides implementation (for methods).

    Syntax-

     public <returnType> <methodName>() {
        <bodyOfMethod>
    }
    

    Ex-1

    List l;              // declaration 
    l = new ArrayList(); // definition 
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: