Exam 1 Flashcards

1
Q

Java Workflow

A

Compile source code -> Check syntax errors -> Execute bytecode -> Check runtime errors -> Finished

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

UML (Unified Modeling Language) meanings

A
All Caps : Constant
# : Protected
\+ : Public
- : Private
Italics : Abstract
Underline : Static
Hollow diamond : Aggregation
Filled diamond : Composition
Hollow triangle : Inheritance
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

UML (Unified Modeling Language) use

A

Used for visualizing classes

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

Javadoc commenting use

A
Comment on class
Comment on member variables
Comment on constructors
Comment on all methods
Use @ symbol with tags to describe specific things (such as parameters and returns)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Primitive versus reference data types

A

Primitive: Set amount of space that is directly pointed to
Reference: Don’t know size of, point to reference/address of object

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

Static versus instance

A

Instance: Unique to each object
Static: Not unique to each object, shared among them. Static methods don’t rely on objects either

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

Can you have multiple classes within a single file?

A

Yes however, only one class can be public

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

Aggregation versus composition versus inheritance

A

Aggregation: ‘Has-a’ relationship but, not dependent on each other
Composition: ‘Has-a’ relationship but, dependent on each other
Inheritance: ‘Is-a’ relationship

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

Using final on classes and methods

A

Final class: Class cannot be inherited from

Final method: Method cannot be overridden

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

How does abstraction fit into polymorphism?

A
We can use abstraction for reference types but not object types
(EX: Shape test = new Rectangle();)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the two things interfaces can only contain?

A

Static constant member variables

Abstract Methods

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

Can interfaces extend other interfaces?

A

Yes, however they cannot extend classes

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

Four principles of Object Oriented Programming

A

Abstraction
Encapsulation
Inheritance
Polymorphism

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

What is the purpose of abstraction?

A

It eliminates the unnecessary, and amplifies the essential

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

What is the purpose of encapsulation?

A

It hides the unnecessary

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

What is the purpose of inheritance?

A

It models the similarity

17
Q

What is the purpose of polymorphism?

A

It allows for the same functions but different behavior

18
Q

Reference type versus object types

A

When creating an object, reference type is on the left side of the equals sign while the object type is on the right side