Lecture 1 Flashcards
What is OOP
Object-Oriented Programming (OOP) is a programming paradigm that models software design around objects, representing real-world entities, and their interactions.
What are the charateristics of OOP
Classes
Objects
Methods
Constructors
Encapsulation
Polymorphism,
Abstraction,
Encapsulation,
Message passing
Data Binding
What is a class in OOP?
A class is a blueprint or template that defines the attributes (properties or fields) and behaviors (methods or functions) common to all objects of a certain type.
What is an object in OOP?
An object is an instance of a class that has its own state and behavior, representing a real-world entity.
What is a method in OOP?
A method is a block of code that performs a specific task or set of tasks.
What are the characteristics of a method?
Characteristics of a method include a unique name, return type, parameters, access modifiers, and can be static (belonging to the class itself) or instance(asscoiated with an object of the class) methods. Methods can also be overloaded.
What is a constructor?
A constructor is a special member function in a class that is automatically called when an object of that class is created.
What is encapsulation?
Encapsulation involves bundling the data (attributes) and methods that operate on the data within a single unit (class) and restricting direct access to the internal state.
What is polymorphism?
Polymorphism is the ability of an object to take on multiple forms,
allowing objects of different types to be treated as objects of a common type through method overloading and method overriding.
What is abstraction in OOP?
Abstraction allows you to represent complex real-world objects in a simplified manner by focusing on essential details and ignoring non-essential details.
How can abstraction be implemented in OOP?
Abstraction can be implemented through abstract classes, interfaces, and regular classes with private methods.
What is message passing in OOP?
Message passing is a mechanism by which objects communicate with each other by sending and receiving messages.
What is inheritance in OOP?
Inheritance is a mechanism that allows a new class to be based on an existing class. Types include single, multiple, multilevel, hierarchical, and hybrid inheritance.
What are access modifiers?
Access modifiers are keywords that control the visibility of class members (e.g., variables, methods).
What are the different types of access modifiers in Java?
The types of access modifiers in Java are public, default, protected, and private.
What is data binding?
Data binding is the process of associating data with its representation in the user interface or code, ensuring synchronization between them.
What is static data binding?
Static data binding, also known as early or compile-time binding, occurs at compile time, linking data with its representation before program execution.
What is dynamic data binding?
Dynamic data binding, also known as late or runtime binding, occurs at runtime, linking data with its representation during program execution and allowing flexibility.
Chateristics of objects
Created using the new keyword
Has a unique state, determined by its attributes
Can perform action throught its methods
When do method overloading and method overriding occure
Method overloading occur at compile time while method overriding occur at runtime
What is method overloading
Method overloading refers to defining multiple methods with the same name but different parameters within the same class
What is method overriding
Method overriding involves creating a method in the child class that has the same name, parameters, and return type as a method in the parent class
What are abstract classes?
Abstract classes are blueprints that define a general structure and functionalities for subclasses.
They enforce abstraction by having abstract methods (without implementation) that subclasses must implement to be useful.
What are interfaces
Interfaces specify what functionalities a class must have but don’t provide any implementation details.
Classes implementing an interface must provide their own code for the specified methods.
what are chateristics of abstractions
Focuses on essential properties and behaviors.
Reduces complexity and enhances understandability.
Provides a clear and concise view of the system.
chateristics of message passing
Objects interact through method calls.
Supports the exchange of information between objects.
Facilitates collaboration and cooperation between objects.
master the code for message passing
what is single inherintance
Single inheritance is a type of inheritance in which a subclass inherits from a single superclass.
what is multiple inherintance
Multiple inheritance is a type of inheritance in which a subclass inherits from multiple super classes.
Multiple inheritance can be implemented in Java by using multiple interfaces.
what is mulitilevel inherintance
Multilevel inheritance is a type of inheritance in which a subclass inherits from a superclass, which in turn inherits from another superclass.
what is hierarchical inherintance
Hierarchical inheritance is a type of inheritance in which a single superclass is inherited by multiple subclasses.
what is hybrid inherintance
Hybrid inheritance is a combination of more than two types of inheritances single and multiple.
chateristics of static data biding
The linkage between data and its representation is determined during the compilation phase.
chateristics of dynamic data binding
The linkage between data and its representation is determined dynamically during program execution.
Allows flexibility and adaptability in the program’s behavior.