When using overloading with type promotion, why method calling is ambiguous?

前端 未结 5 1487
一个人的身影
一个人的身影 2021-01-05 08:26
public class aman {
    void m(double a , int b, int c) {
        System.out.println(\"second\");
    }
    void m(float a , int b, double c) {
        System.out.pr         


        
5条回答
  •  长发绾君心
    2021-01-05 09:12

    public class Test {
    
        void m(int c , int b, int d) {
            System.out.println("Automatic promotion in overloading--->"+c);
    
        }
    
        public static void main(String[] args) {
            Test obj = new Test();
                obj.m('A', 30, 40);
        }
    }
    

提交回复
热议问题