Method Overloading for null argument

前端 未结 7 734
悲哀的现实
悲哀的现实 2020-11-21 13:48

I have added three methods with parameters:

public static  void doSomething(Object obj) {
    System.out.println(\"Object called\");
}

public static  void d         


        
7条回答
  •  闹比i
    闹比i (楼主)
    2020-11-21 14:16

    there is an ambiguity because of doSomething(char[] obj) and doSomething(Integer obj) .

    char[] and Integer both are same superior for null thats why they are in ambiguous .

提交回复
热议问题