How to choose between two method of the same name in Java How to choose between two method of the same name in Java java java

How to choose between two method of the same name in Java


Cast the first argument to the type of the first parameter of the method you want to call, for example:

methodName((A) null, y, z);


Can you use reflection on the object to acquire the method-list? If so, you could then invoke explicitly the method relevant to you. I do believe fivedigit's answer is probably better though ...