PDF Notes: OOP Lecture 8

    Master this deck with 17 terms through effective study methods.

    Generated from uploaded pdf

    Created by @obadajo

    What is inheritance in Java?

    It allows one class to acquire properties of another class.

    What does the 'extends' keyword do?

    It indicates that a class is inheriting from a superclass.

    What is a subclass?

    A class that inherits properties from another class.

    What is a superclass?

    The class whose properties are inherited by another class.

    How does single inheritance differ from multilevel inheritance?

    Single inheritance involves one child class from one parent, while multilevel involves a chain of inheritance.

    What is the purpose of the super keyword?

    It differentiates superclass members from subclass members.

    What is the IS-A relationship?

    It indicates that one class is a type of another class.

    What does the instanceof keyword do?

    It checks if an object is an instance of a class or its superclass.

    What is a HAS-A relationship?

    It indicates that one class contains an object of another class.

    What are access modifiers in Java?

    They specify the scope of classes, methods, and variables.

    What is the default access modifier?

    It allows access to classes in the same package without explicit declaration.

    What does the private access modifier do?

    It restricts access to the declaring class only.

    How does the protected access modifier work?

    It allows access within the same package and subclasses in different packages.

    What is the public access modifier?

    It allows access from any other class.

    What happens to constructors in inheritance?

    Constructors are not inherited but can be invoked from subclasses.

    What is method overriding?

    It allows a subclass to provide a specific implementation of a method already defined in its superclass.

    What is polymorphism in Java?

    It allows methods to do different things based on the object that it is acting upon.