AP® Computer Science A glossary

double

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

The primitive type for real numbers, such as 3.75 or -0.5.

Appears in the course and exam description (CED): 1.2.B.11.3.C.2

A double value is a real number. If at least one value in an operation is a double, the result is a double. A double has limited precision, so round-off error can occur.

double average = 87.5;
System.out.println(average / 2);
System.out.println(7 / 2.0);

Output:

43.75
3.5
Learn it properly, with a checkpoint 1.2 Variables and Data Types

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