Chapter 4 Flashcards
1
Q
What does the class header contain?
A
- An optional acess specifier
- The keyboard class
- Any legal identifier
2
Q
What is a public class?
A
- Accessible by all objects
- Can be extended as a basis for another class
3
Q
What are data fields?
A
The data components of a class
4
Q
What are instance variables?
A
- Nonstatic fields in a class
- One copy exists for each object instantiation
- Each object gets its own copy of each nonstatic data field in its class
5
Q
What is private access?
A
- No other classes can access the field’s values
- Only methods of the same class are allowed to use private variables
6
Q
What is information hiding?
A
- Principle used in creating private access
- Private data can be change only by a class’s own method
7
Q
What are mutator methods?
A
- Set or change field values
- Called setters
- Start with prefix set
8
Q
What are accessor methods
A
- Retrieve values
- Called getters
- Start with prefix get
9
Q
What are class fields
A
Static data fields
10
Q
What is an abstract data type?
A
- A class you create
- Implimentation is hidden and accessed through public methods
- Also called programmer-defined data type
11
Q
How many copies of nonstatic methods in a class are stored?
A
- Just one
12
Q
What is a library of classes?
A
- A package or folder that groups like prewritten classes together
- Java.lang includes fundamental classes and is automatically imported into every program