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)