<<< Method Call Syntax | Index | static Initialization Block >>> |
Not all things in OOP ought to be object-based.
Here is a good example of a statement that calls a static field and a static method to get the job done:
// pi times r squared: // calculate the area of a circle with a given radius. double area = Math.PI * Math.pow(radius, 2);
Any constant data is a perfect candidate to be declared both static and final. For example,
public static final int DAYS_IN_JANUARY = 31;
<<< Method Call Syntax | Index | static Initialization Block >>> |