java趣题(四)

package com.kevin;

/**
 * @author: kevin
 * @Date: 2018/11/8
 */

public class Child {

    public static void main(String[] args) {
        Son f = new Son();
        int a = 2;
        int b = 3;
        f.sum(a, b);
    }
}

class Father {
    public int sum(int a, int b) {
        System.out.println("base_int_int");
        return a + b;
    }
}

class Son extends Father {
    public long sum(int a, long b) {
        System.out.println("child_int_long");
        return a + b;
    }
}

你可能感兴趣的:(java趣题(四))