Encapsulation - a fundamental principle of object-oriented programming, whereby the internal
components of a class are hidden from external classes and are only accessed via getter / setter
methods.
Why use encapsulation? - so that you can change the internal implementation of a class without
affecting other classes.
instantiation - Process of creating an object, an instance of a class; creates space in memory for
the new object and binds a name for the object with the object's data in memory.
OOP - programmers create classes to define new complex data types
Class - a programmer defined data type. A class is a data type definition composed of attributes
(or fields, properties, or instance variables) consisting of primitive data types and references to other
class objects and methods that interact with these attributes.
object - a specific instance of a class. Can be created via the new operator (instantiation)
Object's attributes define what - the state of the object
Object's methods define what - the behavior of the object
A class consists of 3 parts - - 1. name 2. attributes (primitives and/or references to other class
objects) 3. methods
Getters - Methods for obtaining the value of an object's attributes.
Setters - Methods for updating an object's attributes, but do not have a return value.
, constructor - Used to create objects of a class
public method - visible to external classes
private method - only visible within the class it is defined
What is declared as private? What is declared as public? - Attributes are private, constructors,
getters, and setters are public.
programming dependency - a class that you write that can be used by other programmers.
Heap Memory - Global properties in an object and objects themselves are stored in the "heap"
area of a program's memory. Reference types are always on heap and it also has value types
Stack Memory - Local method properties are stored in the "stack" area of memory. Data must
have a known, fixed size. Has value types
has-a relationship - association relationship between objects
is-a relationship - inheritance relationship between objects.
static variable - class variable and is shared by all instances of the class.
static method - class method, not associated with one particular object. Can be called without
having to create an instance of the class.
static methods can access... - static variables, but cannot access instance variables.