OOP Flashcards

https://docs.oracle.com/javase/tutorial/java/concepts/index.html

1
Q

What are the two characteristics of an Object

A

State, Behaviour

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is State

A

Fields/Variables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is Behaviour

A

Methods/Functions. Methods operate on an object’s internal state and serve as the primary mechanism for object-to-object communication

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is Data Encapsulation

A

Hiding internal state and requiring all interaction to be performed through an object’s methods is known as data encapsulation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Why use Objects?

A
  1. Modularity: The source code for an object can be written and maintained independently of the source code for other objects. Once created, an object can be easily passed around inside the system.
  2. Information-hiding: By interacting only with an object’s methods, the details of its internal implementation remain hidden from the outside world.
  3. Code re-use: If an object already exists (perhaps written by another software developer), you can use that object in your program. This allows specialists to implement/test/debug complex, task-specific objects, which you can then trust to run in your own code.
  4. Pluggability and debugging ease: If a particular object turns out to be problematic, you can simply remove it from your application and plug in a different object as its replacement. This is analogous to fixing mechanical problems in the real world. If a bolt breaks, you replace it, not the entire machine.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a class?

A

A class is the blueprint from which individual objects are created.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is Inheritance

A

Object-oriented programming allows classes to inherit commonly used state and behaviour from other classes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is superclass and subclass?

A

In the Java programming language, each class is allowed to have one direct superclass, and each superclass has the potential for an unlimited number of subclasses:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the syntax of creating a subclass?

A

subclassEx EXTENDS superclassEx

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is an Interface

A

An interface is a group of related methods with empty bodies.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the syntax to use an Interface?

A

classEx IMPLEMENTS interfaceEx

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a Package?

A

A package is a namespace that organises a set of related classes and interfaces.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does API stand for?

A

“Application Programming Interface”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly