Chapter 2: Barons Bk Flashcards

(35 cards)

1
Q

An object is characterized by its

A

STATE and BEHAVIOR

•an object is an idea

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

Object reference

A

A variable that represents an object

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

State and behavior of objects

A
Data fields (instant variables) provide the current STATE
•Methods provide the BEHAVIOR and the operations that manipulate the object
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Encapsulation

A

Combining an object’s data and methods into a single unit (class)

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

Class

A

A software blueprint that IMPLEMENTS OBJECTS of a given type

•several things can be created/ manipulated by a class

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

@param

A
  • @param=parameters

* all are instance methods

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

Public

A

ACCESS SPECIFIER

Declaration that the class is usable by ALL client programs

•if not public, class can only be used in its own package

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

Object

A

What is being created/ manipulated in a program (with the operations that manipulate it)

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

Private

A

Keyword that implements info hiding (restriction of access)

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

Private methods and variables can only be accessed

A

By methods of that class

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

Constructor

A

(Method)

Creates an object of the class. It’s name = class name, no return type (void)

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

Several constructors provide

A

Diff ways of initializing class objects

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

Accessors

A

ACCESS METHOD: accesses an object w/o altering it, returns some info about object

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

. Operator (dot operator)

A

Invokes accessor and mutator method

Indicates that a method is of a specific class

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

Mutator method

A

Changes the state of an object by modifying at least one of its instance variables

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

Instance methods

A
Operate on individual objects of a class
Ex: constructors, accessors, mutators
17
Q

Static methods

A

(Class methods) performs an operation for the entire class

18
Q

If a code calls an instance method or a private instance variable for a nonexistent object

A

Syntax error occurs

19
Q

Overloaded methods

A

2 or more methods in the same class that have the same name but diff parameter lists

20
Q

The compiler figures out which method the call by examining

A

The methods signature

21
Q

Signature

A

Consists of the method’s name and a list of the parameter types

22
Q

Example of overloading

A

More than one constructor in the same class

23
Q

Overloading constructors provide a choice of ways to

A

Initialize objects of the class

24
Q

Scope

A

Where can you use the variable? Where is it appropriate?

The region in which that variable or method is visible and can be accessed

25
Block
{ }
26
Implicit parameter
The particular object in which an instance method is called for. =keyword THIS
27
Primitive data types
(Numerical) int, double, char, Boolean, float
28
Reference data types
Objects
29
Primitive data types vs reference data types
Diff = the way they are stored
30
Aliasing
Having 2 references for the same object
31
Null reference
(Null pointer) an uninitialized object variable
32
Null
Keyword used to test whether a variable refers to an object or is uninitialized
33
Method header
Defines the PARAMETERS of that method
34
Actual parameters
ARGUMENTS | have values supplied by a particular method call in a client program
35
Formal parameters
Explicit parameters (in word form) PLACEHOLDERS for the actual parameters