Java Objects & Classes
An object contains data and the behaviors of a single concept. The way we represent objects and how we use them are defined in classes therefore objects are an instance of a class which act as a template or blueprint from which objects are created. The state of an object is stored as member variables and a set of methods that give the object the ability to perform certain tasks. Objects are the foundation of Object Oriented Programming (OOP) and is intuitive in the way we as humans experience the world.
You can declare an object variable without assigning a specific value.

Initialize an object
Explicit initialization of an object

Inferred initialization of an object for local variables within methods

After an object is initialized, data values can be set on the object and methods can be called
var item = new ProductItem();
item.setType("Groceries");
item.displayItem();
Encapsulation
Objects are usually encapsulated to keep software modular and contained.
The objectives of encapsulation are to:
- Restrict access to private data that is specific to that class
- Group data and functionality together to keep objects self-sufficient and independent of each other to support re-usability
