class
Test {
void someMethod ( Boolean obj ) {
System . out . println ( " Hello Boolean " ) ;
}
void someMethod ( Byte obj ) {
System . out . println ( " Hello Byte " ) ;
}
public static void main (
String args [ ] ) {
new Test ( ) . someMethod ( null ) ;
}
};
Options :
a . Compiles fine but throws an exception at runtime
b . Prints " Hello Boolean " when executed
c . Prints " Hello Byte " when executed
d . Compiler error - method call is ambiguous
e . Compiler error - no method matching someMethod ( null ) found
Output d . Compiler error - method call is ambiguous
Howcome we getting a compiler error when clearly Byte is more specific than Boolean.
Byte extends Number extends Object
Boolean extends Object
Please let me know how it works !!
Thanks