1.12

Objects: Instances of Classes

Objects are specific instances of classes, which serve as blueprints defining attributes and behaviors.

1525% of exam
Understand It
Ace It
Context

What this topic is and why it exists

Imagine you have the blueprint for a house.
It specifies everything — the number of rooms, the color of the walls, where the doors go.
But you can't live in a blueprint.
You have to actually *build* a house from it before anyone can walk through the front door.
In Java, a class is that blueprint, and an object is the actual house you build from it.
You can construct dozens of different houses from the same blueprint, each with its own address on the street, its own coat of paint, its own family inside — but they all share the same underlying design.
When you create an object, you're creating a specific *instance* of a class, complete with its own set of attributes stored somewhere in memory.
The variable you use to refer to that object doesn't actually contain the object itself — it holds a reference, like a slip of paper with the house's street address written on it.
You use that address to find and interact with the real thing.
Here's one last detail worth tucking away: every class in Java, no matter what it does, is quietly built on top of a universal foundation class called `Object`.
Think of it as the original architectural code that every blueprint in the language inherits from, even if you never see it directly.
It's the common ancestor of everything you'll ever create.
1 / 9