Sorry I am a newbie to Java. I am trying to get my head around inheritance and subclass/superclass relationships in Java.
If classA is a subclass of classB, will classA\
Public methods, labeled by public
are available to every class.
Protected methods, labeled by protected
are available to subclasses and friendly classes, which are classes in the same package.
Friendly methods, labeled by nothing (i.e. default) are available to friendly classes.
Private methods are available only to the class itself.
Static methods, labeled by static
are available to without an object to access them. These are called by ClassName.foo(), SuperClassName.foo() (unnecessary if not overriden, foo() is acceptable), or ClassName.foo() (unnecessary, foo() is acceptable)
Dynamic (check vocab???) labeled by nothing (i.e. default) are available only if one has an object of the class. ex: bar.foo(), this.foo() (unnecessary, foo() is acceptable), or super.foo() (unnecessary if not overridden, foo() is acceptable)
Overriden methods, annotated by @Override
are only available through super.foo
So in an instance of ClassB, all protected
and public
members and methods of ClassA will be accessible. In a static call, only static methods are accessible.