A function defined in a class or accessed by an object is called a method. Methods can be class-specific, which means every object of said class can use the method (these are called static methods), or specific to the object (instance methods).

Generally, methods are said to be invoked, while functions are called, but that’s just a technicality.

#tosee https://stackoverflow.com/questions/155609/whats-the-difference-between-a-method-and-a-function:

A function is a piece of code that is called by name. It can be passed data to operate on (by the parameters) and can optionally return data (the return value). All data that is passed to a function is explicitly passed.

A method is a piece of code that is called by name that is associated with an object. In most respects, it is identical to a function except for two key differences:

A method is implicitly passed data to operate on by the object on which it was called. A method is able to operate on data that is contained within the class (remembering that an object is an instance of a class - the class is the definition, the object is an instance of that data).

(This is a simplified explanation, ignoring issues of scope etc.)

Method Signature

Generally, a method signature is a unique combination of:

  • The number of arguments
  • The type of each argument
  • The order of all the arguments

What isn’t important in a method signature are:

  • The method identifier: To allow for method overloading, multiple methods can have the same name, as long as the signature is different.
  • The return type

The Java compiler doesn't give a shit about the names or return types

The method signature include the name of the arguments, nor the return type:

//These two have the same function signature
int func(int a, int b)
String func(int HI, int BYE)

In Java, the method signature is extracted from the method definition in the class:

public class Car
{
	//Method definition
	void Accelerate(int customAcc) {}
}
 
//What the compiler sees
Accelerate(int)