Creating and Using Class Methods
Definition Class Object
Class Methods Math methods are an example Can be either void or return Can have parameters or not Must be static Should be public Know how to invoke (call) Be able to evaluate
Parameters Actual vs Formal Formal In the method definition Must have data types Actual In the method call Cannot have data types Must match the formal parameters in type, quantity and sequence
Void methods Can have parameters or not Have the keyword void in the heading
Return methods Can have parameters or not Do not have the keyword void in the heading Have a return statement in the body of the method
Math methods floor ceil round
Random values Use Math.random() Multiply times the range + 1 Add the small value To produce integer values, cast the result to be an integer Example, to produce a random value between 1 and 10: int x = (int)(Math.random() * );
String Methods length charAt indexOf equals