Java: calling a super class' protected method from a subclass - not visible?

Viewed 3983

I am calling a super class' protected method from a subclass. Why is this method "not visible"?

I've been reading some posts such as this one, that seem to contradict the following:

Super class:

package com.first;

public class Base
{
    protected void sayHello()
    {
        System.out.println("hi!");
    }
}

Subclass:

package com.second;

import com.first.Base;

public class BaseChild extends Base
{
    Base base = new Base();

    @Override
    protected void sayHello()
    {
        super.sayHello(); //OK :)
        base.sayHello(); //Hmmm... "The method sayHello() from the type Base is not visible" ?!?
    }   
}
3 Answers
Related