This Blog is Under Construction

Thursday, December 22, 2016

Method Declaration in Java

method signature :
1
2
3
 returnType methodName(Parameters){
            //do the stuff
 }
example :
1
2
3
int sum(int n){
       // do the stuff
}
type of method:
1. instance method
2. noninstance method
3. abstract method 
based on access--
1. accessor method(getter)
2. mutator method(setter)
In summary :



1
2
3
4
5
6
//method name = sum
//method signature = sum(int n)
//method interface = int sum(int n)
int sum(int n){
   //.....................
}

No comments:

Post a Comment