How can I cast an Object to an int in java?
We could cast an object to Integer in Java using below code.
int value = Integer.parseInt(object.toString());
Finally, the best implementation for your specification was found.
public int tellMyNumber(Object any) {
return 42;
}