The signature of a method is the name of the method and types in its parameter list, something like this:

someMethod( int, double, String )

The return type is not part of the signature. The names of the parameters do not matter, just their types.


The name of a method is not enough to uniquely identify it because there may be several versions of a method, each with different parameters. Using the types in the parameter list says more carefully which method you want. The return type can't be used because of the following situation. Say that there are two someMethod() methods: one defined in a parent class like this:

int someMethod( int x, double y, String z )
  //method body

and another method defined in a child class like this:

short someMethod( int a, double b, String c )
  // completely different method body

Somewhere else in the program someMethod() is called:

long w = child.someMethod( 12, 34.9, "Which one?" );

The value on the right of the = could be either int or short. Both can be converted to a long value needed for the variable w. You can not tell which someMethod() matches the statement. In other words, the signatures of the two methods are not unique.


Do these two methods have different signatures?

double aMethod( int x, String y){. . .}

short  aMethod( int a, double b){. . .}