
The toString method’s API is
String toString( )
After the SimpleDate object reference d is instantiated at line 21, it is
printed at lines 22–23 and again at line 24. At lines 22–23, the method
toString is called explicitly; at line 24, it is called automatically. The output
of Example 3.12 is shown in Figure 3.19. Finally, we terminate the program
by calling the exit method of the System class.
3.13 The Math Class
The Math class is also part of the java.lang package. As such, it is automati-
cally available to any Java program; you do not need to use the import state-
ment. The Math class provides two static constants (E and PI ), as well as a
number ...