In AP Computer Science A, the dot operator (.) is the Java symbol that connects an object reference or class name to a method or variable, as in obj.method() for instance methods (EK 1.14.A.1) or ClassName.method() for static methods (EK 1.10.A.2).
The dot operator is the period (.) you put between a name and the thing you want from it. Think of it as Java's possessive apostrophe. Writing myCounter.increment() means "myCounter's increment method," and writing Math.random() means "the Math class's random method."
What goes on the left side of the dot matters. For instance methods, the left side is an object reference, because instance methods are called on objects of the class (EK 1.14.A.1). For class (static) methods and public class variables, the left side is the class name itself, since those belong to the class rather than to any one object (EK 1.10.A.2, EK 3.7.B.2). One more rule the exam loves: if the object reference on the left of the dot is null, the call throws a NullPointerException (EK 1.14.A.2). You can't ask a nonexistent object to do anything.
The dot operator shows up the moment you start using objects in Unit 1 (Topics 1.10 and 1.14) and comes back when you write your own classes in Unit 3 (Topic 3.7). It directly supports LO 1.14.A (develop code to call instance methods and determine the result), LO 1.10.A (develop code to call class methods), and LO 3.7.B (declare class variables, which are accessed with ClassName.variable when public). It's not just syntax trivia. Knowing what belongs on the left of the dot is really a test of whether you understand the difference between an object and a class, which is one of the central ideas of the whole course.
Keep studying AP® Computer Science A Unit 3
Instance method (Unit 1)
Instance methods are the main reason the dot operator exists. EK 1.14.A.1 says instance methods are called on objects using the object name plus the dot operator, like account.deposit(50). The object on the left is the one whose data gets used or changed.
Null reference (Unit 1)
If a variable holds null and you put it on the left of a dot, Java throws a NullPointerException (EK 1.14.A.2). MCQs love this trap, so before tracing any dot-operator call, check whether the reference actually points to an object.
Static variables and methods (Unit 3)
Static members flip the dot operator's left side from an object to a class name. Public class variables are accessed as ClassName.variable because all objects share one copy (EK 3.7.B.2). Same dot, different owner.
Calling a non-void method (Unit 1)
When a method returns a value, the dot-operator call becomes an expression you can store or print, like double x = obj.getValue();. Topic 1.10 also notes that inside the defining class, the class name before the dot is optional for static calls (EK 1.10.A.2).
You won't see a question that just asks "what is the dot operator?" Instead, the exam tests whether you can use it correctly. Multiple-choice questions give you a class definition and ask which call is valid, like choosing between Geometry.circleArea(5.0) and geometry.circleArea(5.0) for a static method, or recognizing that Account.addAccount() works from another class while an instance-style call doesn't. Other stems test tracing, where you follow calls like c.increment() then c.getValue() and determine the result, or spot a NullPointerException when the reference is null. On FRQs, you'll write dot-operator calls constantly in Methods and Control Structures and Class questions. Using an object name where a class name belongs (or vice versa) costs points.
The dot operator itself never changes, but its left side does. Use an object reference for instance methods, like temp.getValue(), because those methods need a specific object's data. Use the class name for static methods and public static variables, like Temperature.cToF(20.0), because those belong to the class and no object is needed. A classic MCQ wrong answer creates an object just to call a static method, which works in real Java but is flagged as not the typical or intended call on the AP exam (EK 1.10.A.2 says class methods are typically called using the class name).
The dot operator (.) connects a name on the left to a method or variable on the right, as in obj.method() or ClassName.variable.
Instance methods are called with an object name and the dot operator, because they operate on a specific object's data (EK 1.14.A.1).
Class (static) methods and public class variables are accessed with the class name and the dot operator, since they belong to the class, not to objects (EK 1.10.A.2, EK 3.7.B.2).
Calling a method on a null reference with the dot operator throws a NullPointerException (EK 1.14.A.2).
Inside the class that defines a static method, you can drop the class name and just write the method call directly (EK 1.10.A.2).
It's the period (.) placed between an object reference or class name and a method or variable, like myObj.getValue() or Math.abs(-3). It's how you access anything that belongs to an object or class.
It depends on what you're calling. Instance methods use the object name, like counter.increment(), while static methods and public static variables use the class name, like Geometry.circleArea(5.0).
Java throws a NullPointerException (EK 1.14.A.2). The variable doesn't point to an actual object, so there's nothing to call the method on. This is a common multiple-choice trap.
Java technically allows it, but the AP CED says class methods are typically called using the class name (EK 1.10.A.2), and exam answer choices treat the class-name version as the correct call. Write Temperature.cToF(20.0), not t.cToF(20.0).
No. The dot operator is just the access syntax, and it works for variables too, like ClassName.CONSTANT for a public static variable (EK 3.7.B.2). A method call adds parentheses and possibly arguments after the name.
Connect this key term to the AP exam workflow: review the course, practice questions, and check related study tools.
Review units, study guides, and course resources.
Check this vocabulary in multiple-choice context.
Apply key concepts in written AP responses.
Estimate the exam score you are working toward.
Review the highest-yield facts before practice.
Put the full course together before test day.