Abstraction

Abstraction

  • Hide complexity, show essentials
  • abstract class vs interface
    abstract classinterface
    InheritanceSupports single inheritanceSupports multiple inheritances
    SubclassUse extends to inheritUse implements to inherit
    InstantiationCannot be instantiatedCannot be instantiated
    ConstructorCan have constructorsCannot have constructors
    Method AccessibilityMethods can be public, protected, default, or privateMethods are public by default
    Method ImplementationMethods can be abstract or concreteMethods are abstract by default
    FieldsField can be final, non-final, static, non-static, public, protected, default, or privateAll fields are public, static, and final by default