what is mean by method signature?
Answers were Sorted based on User's Feedback
Answer / chandmanik20@gmail.com
method signature means:-
1. Name of method.
2. Type of arguments.
3. Number of arguments.
4. Order of arguments.
Is This Answer Correct ? | 7 Yes | 0 No |
Answer / neha rajpal
Method signature means method name and parameter list and also
order of the parameter these three define's the mathod
signature
Is This Answer Correct ? | 3 Yes | 1 No |
It consists of method name and type of the parameters
void sum(int a,int b){}
sum(int,int) is the method signature
In a class we cannot have two methods with the same method
signature
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / vikneswarank
method signature means defind the method in diff signature
diff no arguments
diff datatype if arguments
diff sequence of arguments
for example
public class PolyOverload1
{
public int iEmpNo;
protected double dbSalary;
private boolean boolPermanent;
String strEmpName;
public PolyOverload1()
{
System.out.println("PolyOverload constructor");
iEmpNo = 1001;
strEmpName = "Base Employee";
dbSalary = 20000.500;
}
public void getEmpDetails()
{
// to print the employee details
System.out.println("Emp no : " + iEmpNo);
System.out.println("Emp name : " + strEmpName);
}
//no of arguments difference
public void getEmpDetails(int eno)
{
//to print the employee details
System.out.println("Emp no [getEmpDetails(int eno)]
: " + eno);
System.out.println("Emp name [getEmpDetails(int
eno)] : " + strEmpName);
}
//different type of data type
//note : return type can be different for overloading
public int getEmpDetails(String ename)
{
// to print the employee details
System.out.println("Emp no [getEmpDetails(String
ename)] : " + iEmpNo);
System.out.println("Emp name [getEmpDetails(String
ename)] : " + ename);
return iEmpNo;
}
//no of arguments difference
public void getEmpDetails(int eno, String ename)
{
// to print the employee details
System.out.println("Emp no [getEmpDetails(int eno,
String ename)] : " + eno);
System.out.println("Emp name [getEmpDetails(int eno,
String ename)] : " + ename);
}
//different seguence type of data type
public void getEmpDetails(String ename, int eno)
{
// to print the employee details
System.out.println("Emp no [getEmpDetails(String
ename, String eno)] : " + eno);
System.out.println("Emp name [getEmpDetails(String
ename, String eno)] : " + ename);
}
public static void main (String arg[])
{
//Object creation
PolyOverload1 polyObj = new PolyOverload1();
//static binding or early binding...during compile
time JVM will find that the method's reference to call
polyObj.getEmpDetails();
polyObj.getEmpDetails(1002);
polyObj.getEmpDetails("Test Employee1");
polyObj.getEmpDetails(1003, "Test Employee2");
polyObj.getEmpDetails("Test Employee3", 1004);
}
}
Is This Answer Correct ? | 0 Yes | 1 No |
my method "abc" return array of interface "xyz" and "pqr" is abstract class implements abc and class "jkl" extends pqr My problem 1) when i call abc it retrun array xyz how can i do this hint xyz refer_xyz = new jkl(); but i can't create array. 2)I want to access method of jkl using reference of xyz??
Why do we use threads in java?
Does java support Operator Overloading?
What are reference variables in java?
List out benefits of object oriented programming language?
How are the elements of a gridbaglayout organized in java programming?
What comes to mind when someone mentions a shallow copy in java?
What is a singleton puppy?
State the significance of public, private, protected class?
My application URL : http://localhost:8080/Application/Login.jsp. When a user enter this url in IE then, how it get Login.JSP Page exactly? what are the processes will happen from when we submit the URL to get Login.jsp?
What is the disadvantage of synchronization?
What is Enum in Java?