Page 269 - AP Computer Science A, 7th edition
P. 269

1. Integer and Double objects are immutable: There are no mutator methods in the classes.
2. for a discussion of auto-boxing and -unboxing. This useful feature will not be tested on the AP exam.
THE Math CLAS S
This class implements standard mathematical functions such as absolute value, square root, trigonometric functions, the log function, the power function, and so on. It also contains mathematical constants such as π and e.
Here are the functions you should know for the AP exam:
static int abs(int x)
Returns the absolute value of integer x. static double abs(double x)
Returns the absolute value of real number x. static double pow(double base, double exp)
exp
Returnsbase .Assumesbase>0,orbase=0andexp>0,or base < 0 and exp is an integer.
         static
Returns
static
double sqrt(double x)
double random()
    Returns
section, Random Numbers.)
a random number r, where 0.0 ≤ r < 1.0. (See the next
All of the functions and constants are implemented as static methods and variables, which means that there are no instances of
















































































   267   268   269   270   271