Java Reference
In-Depth Information
These methods are declared as static methods because they do not act
on any particular instance of the Math class; instead, they group a re-
lated set of functionality in the class itself.
A static method cannot directly access non-static members. When a
static method is invoked, there's no specific object for the method to
operate on, and so no this reference. You could work around this by
passing an explicit object reference as an argument to the static meth-
od. In general, however, static methods perform class-related tasks and
non-static methods perform object-related tasks. Asking a static method
to work on object fields is like asking the Walkman factory to change the
serial number of a Walkman hanging on the belt of a jogger in Golden
Gate Park.
 
Search WWH ::




Custom Search