The Java class library is huge. We will not cover it all today. In
fact, the remaining eight classes will focus mostly on the class
library. However, I do want to take this opportunity to look
briefly at one useful class in the library,
java.lang.Math.
This is a class which contains static
methods for performing many standard mathematical operations like
square roots and cosines. You will need it for many of this weeks
exercises.
The Math
class contains several dozen static
methods. Recall that to use a static method from a class, you just
prefix its name with the name of the class followed by a period.
For instance
double x = Math.sqrt(9.0);
You never need to instantiate the Math
class
directly. (In fact you can't. The Math()
constructor
is declared private.)