AP® Computer Science A glossary

Literal

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

The code representation of a fixed value, such as 42, 3.5, true or "hi".

Appears in the course and exam description (CED): 1.3.B.1

A literal is a value written directly in code. Its form sets its type: 7 is an int, 7.0 is a double, "7" is a String and true is a boolean. null is also a literal.

System.out.println(7 / 2);
System.out.println(7.0 / 2);

Output:

3
3.5
Learn it properly, with a checkpoint 1.3 Expressions and Output

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