TLDR
A class is the blueprint, and an object is a specific instance built from that blueprint with its own attribute values. In AP Computer Science A, a variable of a reference type does not hold the object itself; it holds a reference to where the object lives in memory. Topic 1.12 is where you start thinking in terms of objects, references, and how every Java class connects back to the built-in Object class.

Why This Matters for the AP Computer Science A Exam
This topic builds the mental model you use for the rest of the course. Once you understand that an object is an instance of a class and that reference variables store references rather than raw values, everything from String methods to ArrayLists to 2D arrays makes more sense.
On the exam, this shows up most in multiple-choice questions where you describe the behavior of a code segment. You will be expected to tell the difference between a class and an object, recognize that two objects of the same class can hold different data, and understand what a reference variable actually stores. Later free-response code writing also depends on this foundation, since you cannot work with objects you do not understand.
A few scope notes so you do not overstudy. You should know that subclasses extend a superclass and inherit its attributes and behaviors, and that every class in Java is ultimately a subclass of Object. You do not need to design or write inheritance relationships yourself in this course. Keep your focus on explaining the class-object relationship and declaring reference variables correctly.
Key Takeaways
- A class is the blueprint that defines attributes and behaviors; an object is a specific instance of that class with its own attribute values.
- Two objects of the same class share the same methods but can store completely different data.
- A reference variable holds an object reference, which you can think of as the memory address of the object, not the object itself.
- A reference variable can hold
null, meaning it is not pointing to any object yet. - Subclasses extend a superclass and inherit its attributes and behaviors, and every class in Java is a subclass of
Object. - You are responsible for explaining class-object relationships and declaring reference types, not for designing inheritance.
Class vs Object
A class is the formal blueprint of the attributes and behaviors an object will have. An object is a specific instance of that class with defined attributes. If Car is the class, then one actual car you build from it is an object.
Each object keeps its own state through its attributes while sharing the same methods defined by the class. That is why two objects of the same type can behave the same way but hold different data.
</>Java// Car is the class (blueprint) public class Car { private String make; private String model; private int year; public Car(String carMake, String carModel, int carYear) { make = carMake; model = carModel; year = carYear; } public String getCarInfo() { return year + " " + make + " " + model; } }
</>Java// Each variable below refers to a separate Car object Car myCar = new Car("Toyota", "Camry", 2020); Car friendsCar = new Car("Honda", "Civic", 2019); System.out.println(myCar.getCarInfo()); // 2020 Toyota Camry System.out.println(friendsCar.getCarInfo()); // 2019 Honda Civic
myCar and friendsCar are both Car objects, but they store different attribute values and are completely independent.
Reference Variables and References
This is the part that trips people up. A variable of a reference type does not store the object. It stores a reference to the object, which you can think of as the memory address where the object actually lives.
</>JavaCar myCar = new Car("Toyota", "Camry", 2020);
Here, myCar does not contain the car's data directly. It holds a reference that points to the Car object created by new. When you call myCar.getCarInfo(), Java follows that reference to find the object and run the method.
A reference variable can also hold null, which means it is not pointing to any object. Declaring a variable and creating an object are two separate steps.
</>JavaCar myCar; // declared, currently holds null (no object yet) myCar = new Car("Toyota", "Camry", 2020); // now refers to a real object
Classes Are Reference Types
Classes define reference types, the same way int, double, and boolean are primitive types. When you write int x = 5;, x holds the value 5 directly. When you write Car myCar = new Car("Toyota", "Camry", 2020);, myCar holds a reference to a Car object, not the object itself.
Every object created from a class has the same structure defined by that class, but each can store different data.
Where Object Fits In
Java organizes related classes using a hierarchy. Common attributes and behaviors can be placed in a single class called a superclass. Classes that extend a superclass, called subclasses, can use the superclass's existing attributes and behaviors without rewriting them. This is an inheritance relationship.
The big fact to remember: every class in Java is ultimately a subclass of the built-in Object class. You do not need to design or implement inheritance in this course, but knowing that all classes trace back to Object helps later when you see behaviors that every object is guaranteed to have.
How to Use This on the AP Computer Science A Exam
MCQ
- When a question asks you to describe behavior, separate the class from its objects. The class defines what attributes and methods exist; each object holds its own values.
- Expect questions where two objects of the same class store different data. Track each object's state separately.
- Know that a reference variable stores a reference, not the object. Questions may test whether you understand that two variables could refer to the same object or to different objects.
- If a variable was declared but never assigned an object, it holds
null.
Code Tracing
- When you see
new ClassName(...), recognize that a new object is being created and a reference to it is stored in the variable. - Follow each reference variable to the object it points to before predicting output.
- Keep separate notes for each object so you do not mix up their attribute values.
Common Trap
- Declaring a variable does not create an object.
Car myCar;gives you a variable that holdsnulluntil you assign it an object withnew.
Common Misconceptions
- "A class and an object are the same thing." A class is the blueprint. An object is a specific instance built from that blueprint. One class can produce many independent objects.
- "A reference variable stores the object." It stores a reference to the object, which you can think of as a memory address. The object itself lives elsewhere in memory.
- "Declaring a variable creates the object." Declaration and creation are separate. Until you assign an object with
new, the reference variable holdsnull. - "Changing one object changes all objects of that class." Each object keeps its own attribute values. Changing one object's data does not affect another object of the same class.
- "I need to write inheritance code for this topic." You only need to explain the class-object relationship and declare reference variables. Designing and implementing inheritance is not part of this topic.
- "Every class extending Object is something I set up." Every Java class is automatically a subclass of
Object. You do not write that relationship yourself.
Related AP Computer Science A Guides
Vocabulary
The following words are mentioned explicitly in the College Board Course and Exam Description for this topic.Term | Definition |
|---|---|
attribute | The data or properties that define the state of an object or class. |
behavior | The methods or actions that an object or class can perform. |
class | A formal implementation or blueprint that defines the attributes and behaviors of objects. |
inheritance | A relationship in which a subclass draws upon and reuses the attributes and behaviors of a superclass. |
instance | A specific occurrence or realization of a class with its own set of attribute values. |
memory address | The location in computer memory where an object is stored, which is referenced by a reference type variable. |
object | A specific instance of a class with defined attributes and behaviors. |
object reference | A value that points to the memory location where an object is stored, allowing access to that object. |
reference type | A data type that holds a reference (memory address) to an object rather than storing the object's value directly. |
subclass | A class that extends a superclass and inherits its attributes and behaviors. |
superclass | A class that contains common attributes and behaviors shared by multiple related classes. |
Frequently Asked Questions
What is the difference between a class and an object?
A class is a blueprint that defines attributes and behaviors. An object is a specific instance of that class, with its own stored data for the attributes.
What is an object reference in Java?
An object reference is the value stored in a reference variable that points to an object. For AP CSA, think of it as a memory-address-like reference rather than the object itself.
What does null mean for a reference variable?
A reference variable with the value null does not currently refer to any object. Trying to use it as if it refers to an object can cause a NullPointerException.
Can two objects of the same class store different data?
Yes. Two objects can be created from the same class and still store different attribute values. They share the same class definition but have separate object state.
What is the Object class in Java?
Object is the top class in Java's class hierarchy. All Java classes are subclasses of Object, even when that relationship is not written explicitly.
Do I need to implement inheritance for AP CSA Topic 1.12?
No. For Topic 1.12, you should understand the idea of a class hierarchy and that all Java classes are subclasses of Object, but designing or implementing inheritance is outside this topic.