I tried different combination of Method Overloading with Autoboxing and Widening. I got stuck in here.
public void bite(int a, byte b){
System.out.println("here in int-byte");
}
public void bite(byte a, int b){
System.out.println("here in byte-int");
}
In main:
byte a=9,b=8;
//int a=9,b=8;
bite(a, b);
Here error
The method
bite(int, byte)
is ambiguous for the type Overloading
When I reverse the method definition occurrence like:
public void bite(byte a, int b){
System.out.println("here in byte-int");
}
public void bite(int a, byte b){
System.out.println("here in int-byte");
}
Then error:
The method bite(byte, int) is ambiguous for the type Overloading
Please explain how this is happening.