Chapter 2 - Classes and Objects Flashcards
When designing a class, think about
Things the object knows
Things the object does
Instance variables
Things an object knows about itself
Methods
Things an object can do
State
Instance Variables (Knows)
Behavior
Methods (Does)
What represent an object’s state (The Data)
instance variables
Think of instance as another way of saying
object
A class is
A blueprint for an object
One analogy for object is
A packet of unused Rolodex cards. Same blank fields (ivars) Create a new card create a new object
Dot operator (.) gives?
gives access to an object’s state and behavior (ivars and methods)
Two uses of main
Test your real class Launch/start a java application
I represent ‘state’
instance variables
I declare methods
class
I am used to create object instances
class