Java Random Part 2 Class Notes
Java Random Part 2 Class Notes
Example 2
22
Math class
23
Math class
Methods
pow(…) Raise the first argument to the power
specified in second argument
e.g. Math.pow(x,3)
abs(…) Returns absolute value of its argument
max(…) Returns the larger of two int or
double arguments
min(…) Returns smaller …
…
many more
24
Math class
Example
25
Math class
Example 1
public class FindMax
26
Math class
Example 1
27
Integer class
28
Integer class
Methods
29
Integer class
Example
30
Integer class
Example
public class TotalQuantity
31
Integer class
With similarity to the Integer class, there are classes for other types
… these types of classes are called wrapper classes.
These are called wrapper classes because you instantiate an object and
wrap a primitive value inside
Double
Boolean
Byte
Character
Float
Long
Short
33
Aside: Hierarchy of classes
34