PrepGo

AP Computer Science A Flashcards: Calling Instance Methods

Written by AP Content Team, Verified for 2026 AP Exams, Last updated: May 2026

Review key ideas with interactive flashcards. This set includes 10 cards to help you master important concepts.

Define the action of "calling an instance method".
Calling an instance method is the process of using the dot operator on an object to execute one of its methods.
Card 1 of 10

All Flashcards (10)

Define the action of "calling an instance method".
Calling an instance method is the process of using the dot operator on an object to execute one of its methods.
An object `myCar` of the `Car` class exists. Write the code to call its `startEngine()` method.
The code to call the method is `myCar.startEngine();`.
What is the result of the following code? `String name = null; int len = name.length();`
This code will result in a NullPointerException because the `length()` method is called on a null reference.
On what are instance methods called?
Instance methods are called on objects of the class.
How do you determine the result of an instance method call?
You determine the result by developing and running the code that makes the call and observing the outcome.
What two components are syntactically required to call an instance method?
An object name and the dot operator are required to call an instance method.
What operator is used to call an instance method?
The dot operator is used along with the object name to call instance methods.
What specific condition on an object reference leads to a NullPointerException when a method is called?
A NullPointerException occurs when the object reference is null.
What happens when you attempt to call an instance method on a null reference?
A method call on a null reference will result in a NullPointerException.
What is a NullPointerException?
A NullPointerException is the result of a method call on a null reference.