//Question :
//What happens when the following class is compiled & run ?
class AmbiguosMethodCall {
void something ( int i ) {
System . out . println ( i ) ;
}
int something ( int i ) {
System . out . println ( i + 1 ) ;
return i + 1 ;
}
public static void main (
String args [ ] ) {
AmbiguosMethodCall obj = new AmbiguosMethodCall ( ) ;
obj . something ( 67 ) ;
}
}
/*
Options :
a . Compiles fine but throws AmbigousMethodInvocationException at runtime
b . Compiler error - the call to method something ( ) is ambiguos
c . Compiler error - methods can't be defined with a different return type
d . Compiles fine & prints 67 at runtime
*
*How come is the answer b. How come the compiler
*treat void somethig(int) and int something(int) as same
*same methods???. I think they are netiher overloaded
*nor overridden. They are just two differnt methods with
*same names/