-1

I'm not sure if I understand correctly whether I can access all kind of classes based on their modifier (even the private ones) from the super.() or just the public and protected ones.

If I extend a class it's a subclass of the first, so super can bring me only the protected and public ones. Am I correct?

Community
  • 1
  • 1
Diolor
  • 13,181
  • 30
  • 111
  • 179

1 Answers1

0

super.method() will let you call "method()" in the superclass, if you are overriding method() in the subclass. It's not a question of what you can access with super, but what methods you can override in a subclass:

  • public

  • protected

  • default (no qualifier) IF the subclass is in the same package as the superclass.

And only if the method isn't final.

schmop
  • 1,440
  • 1
  • 12
  • 21