The following java code will not execute.
class A{
int sqrt(int a)
{
}
float sqrt(int a)
{
}
int a1 = sqrt(a);
float b1= sqrt(b);
}
In interview i was asked by a question that why java compiler does not check the data type and call that method accordingly. What is the reason?
Those methods have the same signature (identifier + parameter list), which is illegal.