Java Study Guide: Classes and Objects

Identity
A property of an object. Each object is distinct.
State
Current values of an object’s attributes at a given time.
Behavior
How an object acts or interacts with other objects defined by the object’s methods.
Primitive
Built-in data type. 8 types: byte, short, int, long, float, double, boolean, char.
Byte, short, int, long, float, double, boolean, char.
What are the 8 primitive types?
Class
User- defined type. Think of it as cookie cutter from which objects are created or a blueprint from which objects are built.
Object
Instance of a class.
Instantiate
Create an object. Use the new keyword to _______ objects.
Encapsulation
Also known as data hiding. You keep the implementation details of a class hidden from the user by making attributes private and provide access to data through public methods.
Garbage collection
Part of the Java system that reclaims lost objects so that the memory can be reused.
Constructors
A special method that initializes the state of new objects as they are created.
New
Java keyword used to create objects.
Accessors
Methods that access an object’s data without changing the data.
Mutators
Methods that change the state of an object by modifying at least one of its attributes.
This
Refers to the current object. Common use of this keyword is to resolve naming conflict with variables and attributes.
public name (conditions to create an object)
How do you write a constructor?
Reference
All the other types are reference types: they reference objects.