Chapter 2: Barons Bk Flashcards
An object is characterized by its
STATE and BEHAVIOR
•an object is an idea
Object reference
A variable that represents an object
State and behavior of objects
Data fields (instant variables) provide the current STATE •Methods provide the BEHAVIOR and the operations that manipulate the object
Encapsulation
Combining an object’s data and methods into a single unit (class)
Class
A software blueprint that IMPLEMENTS OBJECTS of a given type
•several things can be created/ manipulated by a class
@param
- @param=parameters
* all are instance methods
Public
ACCESS SPECIFIER
Declaration that the class is usable by ALL client programs
•if not public, class can only be used in its own package
Object
What is being created/ manipulated in a program (with the operations that manipulate it)
Private
Keyword that implements info hiding (restriction of access)
Private methods and variables can only be accessed
By methods of that class
Constructor
(Method)
Creates an object of the class. It’s name = class name, no return type (void)
Several constructors provide
Diff ways of initializing class objects
Accessors
ACCESS METHOD: accesses an object w/o altering it, returns some info about object
. Operator (dot operator)
Invokes accessor and mutator method
Indicates that a method is of a specific class
Mutator method
Changes the state of an object by modifying at least one of its instance variables