1.10

Calling Class Methods

Class (static) methods are called using the class name and dot operator, not through an object instance.

1525% of exam
Understand It
Ace It
Context

What this topic is and why it exists

Imagine you walk into a bakery and see a sign on the wall: "We bake at 350°F." That rule belongs to the *bakery itself* — not to any single loaf of bread.
You don't need to pick up a specific croissant and ask it what temperature the ovens run at.
The building just knows.
That's exactly how class methods work in Java.
A class method belongs to the class as a whole, not to any particular object you've created from it.
You can spot one by the keyword `static` in its header.
To call it, you use the class name, a dot, and then the method — like `Math.25\sqrt{25}`.
You never had to create a `Math` object first; you just asked the class directly, and it handed you `5.0`.
The class itself is the bakery wall; the method is the sign.
One small shortcut worth knowing: if you're writing code *inside* the same class where the method lives, you can skip the class name entirely.
Java already knows where to look.
But when in doubt — especially on the AP exam — using the class name makes your intent crystal clear and keeps your code easy to read.
1 / 9