Method Signature

Method Signature

In this tutorial, we are going to discuss Method Signature in java. In java method signature consists of method name and arguments list ( including order also).

public static int minimum(int x, int y) {

}

Here minimum(int x, int y) is method signature. Compiler uses method signature to resolve method calls. Two methods with the same signature are not allowed in any java class, violation leads to compile time error.

Method Signature
public class Test {
   public void m1(int i) {
   }
   
   public void m2() {
   }
   
   public int m1(int i) {
   }
   
   public void m1(int i, float f) {
   }
}

C.E: m1(int) is already defined in Test

In java return type is not part of method signature.

Method Signature

Scroll to top