两个重载方法,一个方法参数为String对象,另一个为Object对象,调用时传的参数为null,请问调用哪个方法
1.package test;
2.
3.public class Test {
4.
5. public void myMethod(String str) {
6. System.err.println("string");
7. }
8.
9. public void myMethod(Object obj) {
10. System.err.println("object");
11. }
12.
13. public static void main(String[] args) {
14. Test t = new Test();
15. t.myMethod(null);
16. }
17.}
为什么输出是string,而不是object