AP Computer Science a Flashcards: Object Creation And Storage Instantiation

Study Object Creation And Storage Instantiation 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 is the syntax to create a new object of class Car?

Tap card or press Space to flip

ANSWER

Car myCar = new Car();. Standard object creation: declare variable, use new, call constructor.

1 / 36

AP Computer Science a: Using Objects and Methods

All flashcards

36 cards

What this deck covers

This deck focuses on Object Creation And Storage Instantiation, 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 19Practice questions for this set
Consider the following class; what method would you call to achieve starting the engine?
public class Car {
    private String make;
    private String model;

    // Constructor creates a Car object with identifying information.
    public Car(String make, String model) {
        this.make = make;
        this.model = model;
    }

    // startEngine prints a message using stored fields.
    public void startEngine() {
        System.out.println("Engine started: " + make + " " + model);
    }

    public static void main(String[] args) {
        Car myCar = new Car("Ford", "Focus");
        // The object is used via its reference.
    }
}
Choose an answer

Keep your progress across every deck

Free account · cards you mark are saved to it