AP Computer Science A Quiz
19 questions · no time limit
0:00
USING OBJECTS AND METHODS
Question 1 of 19
No time limit
Current
Answered
Flagged
Not seen
Consider the following class; what method would you call to achieve starting the engine?
public class Car {
private String make;
private String model;
private boolean engineOn;
// Constructor initializes a new car with engine off
public Car(String make, String model) {
this.make = make;
this.model = model;
engineOn = false;
}
// Method turns the engine on
public void startEngine() {
engineOn = true;
}
public static void main(String[] args) {
// Object is instantiated, then a method is invoked to change its state
Car myCar = new Car("Honda", "Civic");
// Invoke the method here
}
} YOUR PROGRESS
19
QUESTIONS
Ready when you are
Answer in any order. Your progress shows here as you go.
QUESTIONS
KEYBOARD
Pick an answer ABCD
Next question ↵→
Previous ←
Flag for review F
Answers save as you go · flagged questions come back at the end