class parent
{
public void disp(int i)
{
System.out.println("int");
}
}
class child extends parent
{
private void disp(long l)
{
System.out.println("long");
}
}
class impl
{
public static void main(String... args)
{
child c = new child();
c.disp(0l); //Line 1
}
}
编译器抱怨如下
inh6.java:27: error: disp(long) has private access in child
c.disp(0l);
给定的输入是 0L,我正在尝试重载子类中的 disp() 方法。