03 - Objects as a Programimng Concept Flashcards
What are instance attributes?
Attributes (fields) that belong to each instance of the class
Example: Every dog has its own colour.
What are class attributes?
Attributes that belong to the entire class
Example: An attribute that keeps a running total of how many instances there are of that class.
Define instance methods.
Methods that belong to the instance of the class
Example: getField(), setField()
Define class methods.
Methods that belong to the entire class and do not require an instance to call
Example: System.out.println()
What is decomposition in object-oriented programming?
The process of breaking down complex objects into simpler objects to understand them better.
What does ‘dependency’ mean in the context of object relationships?
A basic relationship where one entity is dependent on another, described as a ‘USES’ relationship.
What is aggregation in object relationships?
A form of association where one object ‘HAS A’ relationship with another, indicating a directional association.
What is composition in object relationships?
A stronger form of association where the contained object is fully encapsulated within another object and is destroyed with it.
What is the relationship indicated by ‘IS A’?
An inheritance relationship where one class is a subtype of another.
How is inheritance implemented in Java?
Using the keywords ‘extends’ for classes or ‘implements’ for interfaces.
Why is reducing dependencies between objects important?
It decreases maintenance overheads and simplifies system updates.
What are the four key data types in Java?
1) Integer (int)
2) Real (double)
3) String (String)
4) Boolean (boolean)
How much RAM does a boolean type use in Java?
1 byte.
How much RAM does an integer type use in Java?
4 bytes.
How much RAM does a real type use in Java?
8 bytes.