Back to Using Objects

Lesson PreviewLesson 7 of 10 in this unit

2.6 String Objects: Concatenation, Literals, and More

Part of Using Objects in AP® Computer Science A. Read the opening section, then create a free account for the full interactive lesson, practice, and progress tracking.

String Objects: Concatenation, Literals, and More

In Java, primitive data types (like int, double, and boolean) store actual values directly in variables. These types are simple and predefined by the language. Reference data types, on the other hand, store references (or "pointers") to objects in memory. Instead of holding the actual data, a reference data type stores the location where the object’s data is stored. Strings in Java are reference data types because they are objects, even though they behave like primitives in some ways.

Continue the full lesson in Stellar

Create a free account to unlock the remaining sections, checkpoints, course practice, and progress tracking for AP® Computer Science A.