As class com.package1.Foo
and class com.package2.Nee
are in two different packages so Nee
class instance will not allow you invoke protected method of that class.
Create the instance Foo
which is subclass of Nee
then invoke the protected method,.
Foo foo = new Foo();
foo.sayProtected()