Constructors in Java
A constructor runs when you create an object. It sets starting values. Same name as the class. No return type — not even void. new Box(4) calls the constructor and creates the object.
If you write no constructor, Java adds an empty default one. A parameterized constructor takes values at creation. You can overload: many constructors with different parameter lists.
void Box() is a normal method, not a constructor. That is the classic trap. Contrast: constructor initialises; method does later work.
Let's take this on the board with one tiny Main class — no extra files. Constructors in Java — output: 4. new Box(4) runs the constructor and sets side. No setter needed. Start from main, go line by line, and stop at each print. That output is the proof for Constructors.
Contrast constructor vs method: return type is the difference.