A method signature can be very simply defined as the method name followed by the parameter types. Say, for example, we have a method that adds two numbers. This is the method signature of this kind of method:
addNum(int, int)
The actual method is shown in the following code block. This method has to be invoked from another method or from the main() method, as in the following:
public int addNum(int num1, int num2) {
int result = num1 + num2;
return result;
}
Method call: addNum(10,20)
Output: 30
In the sections that follow, we will be looking at the method signatures of various important methods. But first, let's understand a concept of Java called List, which we will see in the findElements method.