AP Computer Science a Flashcards: Calling Class Methods

Study Calling Class Methods in AP Computer Science a with focused flashcards that help you recognize the idea, recall the key rule, and apply it in practice-style prompts.

QUESTION

What happens if you call a static method with a null reference?

Tap card or press Space to flip

ANSWER

No error; static method is called on class. Static methods belong to class, not instance.

1 / 23

AP Computer Science a: Using Objects and Methods

All flashcards

23 cards

What this deck covers

This deck focuses on Calling Class Methods, giving you a quick way to review the definitions, rules, and examples that matter most for AP Computer Science a.

How to use these flashcards

Work through these flashcards in short sessions. Try to answer each prompt before flipping the card, then revisit any cards you miss until the explanation feels automatic.

Practice questions

1 of 17Practice questions for this set
Consider the following class for student records. The StudentRecord class has addGrade(double points) and calculateGpa(int numClasses) that returns totalPoints / numClasses. It also has getName() that returns the student name. A program instantiates StudentRecord r = new StudentRecord("Liam"); then calls r.addGrade(9.0). The expected output of calculateGpa depends on the parameter value. If calculateGpa(3) is called, what is the expected result?
Choose an answer

Keep your progress across every deck

Free account · cards you mark are saved to it