The whole world can be divided into a series of interactions between one object and another
State: What is the object? What does it look like? (adjectives).
Behavior: What is its purpose? What can it do? (verbs).
All objects can be described in two ways -- through states and behaviors.
States and Behaviors
The blueprints for the construction of an object
Defines what the object will look like and what it will do when it is constructed
Redefinition of a Class
Objects do not have main methods in them, because they are simply objects. A main method is like the "start"
button to the whole system. An object is not a system -- it is a piece of the system.
Example: A program is written to have a person get out of bed and make a cup of coffee. The person, bed, and
coffee maker are all objects. The main method would be in another class (known as a driver) that basically
commands the objects to interact in certain ways to produce the desired result.
Essentially, with the creation and manipulation of objects, the programmer gets to play God.
A "main-less" Class
Describe the state of the object
Placed at the top of the code, outside of any method
Describes how to build the object
When the code is run and it tries to construct this object, it needs to know how to do it.
Constructors always match the class name, are always public, and have no return type.
Basically initializes the instance variables -- either to default values or to values given as parameters
After the instance variables, constructors, and encapsulation are finished, the other methods of the object
must be specified. We have figured out how to describe it and how to build it, and now we need to establish
what the object can do.
Standard Formatting of Objects
A driver program is used to manipulate the object
Functions just like a normal main method
The class with the main method does not usually function as an object. The other classes specify on the construction