AP® Computer Science A glossary

Math class

Course: AP® Computer Science A Shows up in: Unit 1: Using Objects and Methods

A class in java.lang that contains only class methods for common calculations, such as abs, pow, sqrt and random.

Appears in the course and exam description (CED): 1.11.A.11.11.A.2

No import is needed. abs(int) returns an int; abs(double), pow, sqrt and random return a double.

System.out.println(Math.pow(2, 3));
System.out.println(Math.sqrt(2.25));

Output:

8.0
1.5
Learn it properly, with a checkpoint 1.11 Math Class

Related terms

Was this page helpful?

No names are ever shown, and every public comment is checked by us first. Please do not include personal details. To get a reply, email [email protected].

↑ Top

Enlarged view of the selected figure