-
What is the output of the following code?
public class output
{
public void method1 (int i,float f)
{
System.out.println(" int float method");
}
public void method2(float f,int i);
{
System.out.println("float int method");
}
public static void main(String[]args)
{
output s=new output();
s.method1(10,10);
}
}
-
- float int method
- int float method
- Runtime error
- Compiletime error
- None of these
Correct Option: D
While resolving overloaded method, compiler automatically promotes if exact match is not found. But in this case, which one to promote is an ambiguity.