invocation

Which overload will get selected for null in Java?

落爺英雄遲暮 提交于 2019-11-25 23:26:01
问题 If I write this line in Java: JOptionPane.showInputDialog(null, \"Write something\"); Which method will be called? showInputDialog(Component parent, Object message) showInputDialog(Object message, Object initialSelectionValue) I can test it. But in other cases similar to this, I want to know what happens. 回答1: The most specific method will be called - in this case showInputDialog(Component parent, Object message) This generally comes under the "Determine Method Signature" step of overload