How can I make a method take a null value?
问题 If you have two overloaded methods like so: public void methodName(File file){} public void methodName(String string){} If you try to call methodName with null you will get an error saying that it's ambiguous which is understandable because it doesn't know which method to do. I know that you can just cast the null: methodName((String) null) but how can I create a method specifically to handle the situations where you call methodName(null) ? Something like this: public void methodName(null