A class is a blueprint; an object is a house built from it. One blueprint, as many houses as you like.
1 class = blueprint
It declares fields (data) and methods (behavior), but holds no live data itself.
2 object = real thing
new Car("Civic") builds an instance that owns its own copy of every field.
3 constructor
A special method, named after the class, that runs once and sets up the new object.
4 methods act
drive() can change fields — each car changes only its own speed.
Blueprints and houses
class = blueprint1It declares fields (data) and methods (behavior), but holds no live data itself. object = real thing2new Car("Civic") builds an instance that owns its own copy of every field. constructor3A special method, named after the class, that runs once and sets up the new object. methods act4drive() can change fields — each car changes only its own speed. 4 building blocks make up Blueprints and houses
Press play: the constructor fills the new object, then drive() changes its fields and prints.
JVMThe JVM loads the file — two classes live here: CarDemo with main, and the Car blueprint.
Memory
no variables yet — press play
Console
output appears as the program runs…
Every method call pushes a frame; every return pops one. Play the script to see main, the constructor and drive() come and go.
Drag to orbit the scene. Press Play to watch memory in action.
Click a term, then click its description to lock the pair.
5 conceptsTap a card to expand ?classdrops into place
?objectdrops into place
?constructordrops into place
?methoddrops into place
?fielddrops into place
Two objects from one class — who owns what?
Your predicted output — one line per console line
Hint: Each object owns its own count — a.up() never touches b.
01A class is a blueprint; objects are the things built from it.
02new creates the object on the heap and runs the constructor.
03Each object owns its fields — myCar.speed is independent of every other car.
04Method calls push a frame on the stack; returns pop it.
05Two objects from one class never share field values unless you make them.