Chapter 4 Flashcards
State
what does the object know?
behaviors
what does it do?
Methods define
behaviors
class
blueprint of an object
ex: s.toUppercase();
string class is provided, but we can
make our own classes
constructor method instantiates
an object EX: new Scanner(System.in)
face variable in the Coin class
is called instance data or instance variable
___ variables point directly at its values in memory
primitive
ex: int, double, boolean
____ variables point to the object’s address
reference variables
ex: string
abstraction
can use object without knowing how they work
Encapsulation
seperates external from internal,
the plastic of the black box
Encapsulation internal
variables object holds and the methods that make the object useful
Encapsulation external
the service that an object provides and how it interacts
Self governing
change to and object’s state should be made through the methods
Two visibilty modifiers
public and private
public visibility
class interface, methods
private visibility
Internal to the object, private
private variables
getters/accessors, and setters/mutators
Code for getter/setter
get()/set()
Driver program
controls and tests other parts of the program
Method
runs programs when the method is called
Method changes flow of control by
making it jump to the code within the method and then jumping back
method header blueprint
visibility return-type method-name(parameter list)
{method body}
scope
area in which a variable is defined and can be used