Skip to main content

Section 4.13 ObjUse-WE6-P1

Subgoals for Calling a Method.

  1. Classify method as static method or instance method
    1. If static, use the class name
    2. If instance, must have or create an instance
  2. Write (instance / class) dot method name and ( )
  3. Determine whether parameter(s) are appropriate
    1. Number of parameters passed must match method declaration
    2. Data types of parameters passed must be compatible with method declaration
  4. Determine what the method will return and where it will be stored
  5. Evaluate right hand side of assignment. Value is dependent on method’s purpose

Subsection 4.13.1

Here are some of the common Math methods, which are all static.
Figure 4.13.1.

Subsection 4.13.2

For the following questions, fill in the blanks with NO spaces.
For example, use Math.pow(x,y) rather than Math.pow(x, y)

Exercises Exercises

1.
Q17: Fill in the blank to print the absolute value of the variable theta.
System.out.println();
2.
Q18: Fill in the blank to print the value of 16 raised to the power of 5.
System.out.println();
3.
Q19: Fill in the blank to print the maximum value of alpha and beta.
System.out.println();
You have attempted of activities on this page.