Ch 6 Test Flashcards Preview

Foundations > Ch 6 Test > Flashcards

Flashcards in Ch 6 Test Deck (68)
Loading flashcards...
0

Object

A runtime entity that contains data and responds to messages

1

Class

A software package or template that describes the characteristics of similar objects

2

(Class) instance variable declarations

Define an object's data requirements

3

(Class) methods

Define a class's behavior in response to messages

4

Encapsulation

The combining of data and behavior into a single software package

5

Instantiation

The process of creating a new object

6

When a Java program is executing...

The computers memory must hold:
All lads templates in their compiled form
Variables that refer to objects
Objects as needed

7

Each methods compiled byte code is stored...

In memory as part of its class's template

8

Memory for data is...

Allocated within objects

9

Although all class templates are in memory at all times

Individual objects come and go

10

An object occupies memory when...

If is instantiate and disappears when no longer needed

11

Garbage collection

The JVM process of keeping track of which objects need to be stored and which can be deleted

12

(3 characteristics of an object)
Behavior

defined by the methods of its class

13

(3 characteristics of an object) state

At any moment the instance variables have particular values, which change in response to messages sent to the object.

14

(3 characteristics of an object)
Identity

Distinguish from other objects in memory, as handles by the JVM

15

Of variables in an object there can be....

None one or several
When there are none the garbage collector purges the object from memory

16

Clients

Send messages
Only need to know the servers interface
Information hiding hides servers data requirements and list of supported methods from clients

17

Using student objects
First

Declare variables then assign values to variables before using them

18

Mutators

Messages that change an objects state

19

Accessors

Messages that access the objects state. Used to see if a mutator works correctly

20

An object can be assigned ... Variables

Two

21

At any time it is possible to break the connection to a variable and the object it references by...

Assigning the null value to the variable

22

In Java all types fall into two categories:

Primitive: int, double, Boolean, char and longer and shorter versions of these
Reference: String, Scanner, Student, and all classes

23

Null value can be assigned to

Reference variables
If it pointed to an object and no other variable points to the object the objects memory goes to the garbage collection

24

Null pointer exception

When a program attempts to run a method with a null object

25

All classes have a similar structure consisting of 4 parts:

The class's name and modifying phrases

A description of instance variables

One or more constructor that indicates how to initialize an object

One or more methods that specify how an object responds to messages

26

Class definitions

Usually begin with the keyword public

27

Class names

User defined symbols that adhere to rules for naming variables and methods

28

Java organizes classes In a hierarchy:

Base: object
Superclasses and subclasses
Each class, except object, can have one parent and any number of children

29

Inheritance

A new class inherits the characteristics of its superclass
Extends the superclass by modifying and adding