TOP CATEGORIES

×

What is method signature in Java?

A

Arnav Verma

Method signature in Java

The method signature is very important in Java programming. The method signature is the combination of the method name and parameter list, i.e. both in combined form make the method signature. In the case of the method overloading, the method signature plays a very important role. Let's understand by taking an example.

Example. 1

public int getSum(int a, int b, int c)

{

 // method code

}

Example. 2

public int getSum(int a, int b)

{

 // method code

}

In both examples, getSum method is different because they have different method signature. In example 1, the method name is getSum with three int type parameters whereas in example 2 the method name is also getSum but this method has two int type parameters. 

Method signature in Java depends on

  • Method name and parameter combination.
  • Method name and parameter numbers.
  • Method name and type of parameters.
  • Method name and order of parameters. etc.

I hope this piece of information will help you to understand what is method signature in Java.

0 votes

Your Answer

Email: advertise@gdatamart.com

Donate: To Support US

© 2024 GDATAMART.COM (All Rights Reserved)