AP® Computer Science A glossary

null

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

A special literal meaning a reference variable is not associated with any object.

Appears in the course and exam description (CED): 1.4.A.11.13.B.1

A reference variable holds an object reference or, if there is no object, null. Printing a null variable prints null, but calling a method on it throws a NullPointerException.

String nickname = null;
System.out.println(nickname);

Output:

null
Learn it properly, with a checkpoint 1.13 Object Creation and Storage (Instantiation)

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