INTRODUCTION TO OOP Flashcards
Describe object-oriented programming
A method of programming based on a hierarchy of classes with well defined and cooperating objects.
What is an object?
An object is an executable copy of a class. It can also be referred to as an instance
What are states and behaviors, give real world examples
For a dog:
states (breed, color, age, hungry) - nouns and adjectives
behaviors (barking, eating, fetching) -verbs
What are fields and methods?
- An object stores its state in fields and exposes its behavior through methods.
- Methods operate on an object’s internal state and IMPLEMENT object-to-object communication.
What is a class?
A blueprint from which objects are created. It defines the data and the methods to work on the data
What is a package and what is its importance?
- A package is a namespace that organizes a set of related classes and interfaces. (It is like different folders on our personal computer.)
- Packages are important for organization.
Where can one find a complete listing of all packages, interfaces, classes, fields, and methods supplied by the Java SE platform.
The Java Platform API Specification
*application programming interface
What is an interface?
- An interface is a group of related methods with empty bodies.
- Methods form the object’s interface with the outside world; e.g remote buttons, computer keyboards, e.t.c.
What are some characteristics of OOP?
- Encapsulation
- Inheritance
- Abstraction
- Polymorphism
- Message passing
- Garbage collection
Define encapsulation
- This is a concept that enables the hiding unnecessary details in classes and only providing a clear and simple interface for working with them.
- It is also called information hiding.
- An object must provide its users only with the essential information for manipulation, without the internal details.
What is inheritance
- Inheritance is a concept in OOP that enables new objects to take on the properties of existing objects.
- Object-oriented programming allows classes to ASSUME commonly used state and behavior from other classes.
- Inheritance is an “is a” relationship eg a dog is a animal; therefore it inherits the characteristics common to animals
What are the names of classes involved in inheritance?
- A class that is used as the basis for inheritance is called a superclass or base class.
- A class that inherits from a superclass is called a subclass or derived class.
- In Java, each class is allowed to have one direct superclass, and each superclass has the potential for an unlimited number of subclasses
What is abstraction?
The process of representing essential features without including background details or explanations / The process of defining the essential concepts while
ignoring the inessential details.
What are the types of abstraction?
- Data Abstraction
- Functional Abstraction
- Object Abstraction
What is polymorphism?
This is the ability to present the same interface for differing underlying forms.