What are the differences between method overriding and method overloading?
Overriding: Same method signature in subclass and superclass | Overloading: Same method name but different parameters in the same class.
What are the differences between single inheritance and multiple inheritance?
Single Inheritance: A class inherits from only one superclass | Multiple Inheritance: A class inherits from multiple superclasses (not supported in Java directly).
What are the differences between static and dynamic typing?
Static typing: Type checking at compile time | Dynamic typing: Type checking at runtime.
What are the differences between public and private members in the context of inheritance?
Public: Accessible from anywhere | Private: Only accessible within the class where they are defined, not inherited directly.
What are the differences between using 'extends' and 'implements' keywords?
'extends': Used for inheritance between classes | 'implements': Used for a class to implement an interface.
What are the differences between an abstract class and an interface?
Abstract Class: Can have method implementations and instance variables | Interface: Only method signatures (before Java 8) and constant variables.
What are the differences between inheritance and aggregation?
Inheritance: Creates a strong 'is-a' relationship, subclass depends on superclass | Aggregation: Creates a 'has-a' relationship, weaker dependency.
What are the differences between using inheritance and creating separate, unrelated classes?
Inheritance: Promotes code reuse, establishes hierarchical relationships | Separate Classes: No inherent relationship, can lead to code duplication.
What is the definition of Inheritance?
A mechanism where one class (subclass) acquires the properties (methods and instance variables) of another class (superclass).
What is the definition of a Superclass?
The class whose properties are inherited by another class.
What is the definition of a Subclass?
The class that inherits properties from another class (the superclass).
What is the definition of Polymorphism?
The ability of an object to take on many forms. Allows an object to be treated as an instance of its own class or its parent class.
What is the definition of Object-Oriented Programming (OOP)?
A programming paradigm based on the concept of 'objects', which contain data and code to manipulate that data.
What is the definition of Method Overriding?
When a subclass provides a specific implementation for a method that is already defined in its superclass.
What is the definition of the 'extends' keyword in Java?
A keyword used in Java to indicate that a class inherits from another class.
What is the definition of the 'super' keyword in Java?
A keyword used to access members of the superclass from within a subclass.
What is the Diamond Problem?
A problem that arises in multiple inheritance where a class inherits from two classes that have a common ancestor, leading to ambiguity in method resolution.
What is Dynamic Typing?
Type checking is done during run-time.
What is Static Typing?
Type checking is done during compile-time.
How is inheritance applied in GUI frameworks?
GUI components (e.g., buttons, text fields) are often created as subclasses of a base component class, inheriting common properties and behaviors.
How is inheritance used in creating different types of bank accounts?
A base 'Account' class can be a superclass for 'SavingsAccount' and 'CheckingAccount', inheriting common account properties and methods.
How can inheritance be applied in a game development context?
A base 'GameObject' class can be a superclass for different game entities like 'Player', 'Enemy', and 'Item', sharing common properties like position and collision detection.
How is inheritance applied in creating different types of employees in a company?
A base 'Employee' class can be a superclass for 'Manager', 'Developer', and 'SalesPerson', inheriting common employee attributes and methods.
How is inheritance used in representing different types of vehicles?
A base 'Vehicle' class can be a superclass for 'Car', 'Truck', and 'Motorcycle', inheriting common vehicle properties and methods.
How is inheritance applied in creating different shapes in a drawing application?
A base 'Shape' class can be a superclass for 'Circle', 'Rectangle', and 'Triangle', inheriting common properties like color and position.
How is inheritance used in representing different types of media files?
A base 'MediaFile' class can be a superclass for 'AudioFile', 'VideoFile', and 'ImageFile', inheriting common properties like file size and format.
How is inheritance applied in creating different types of users in a social media platform?
A base 'User' class can be a superclass for 'Admin', 'Moderator', and 'RegularUser', inheriting common user attributes and methods.
How is inheritance used in representing different types of geometric figures?
A base 'Figure' class can be a superclass for 'Square', 'Circle', and 'Triangle', inheriting common properties like area and perimeter calculations.
How is inheritance applied in creating different types of network connections?
A base 'Connection' class can be a superclass for 'WifiConnection', 'BluetoothConnection', and 'EthernetConnection', inheriting common connection properties and methods.