Challenge for The Code for Creating and Using Objects
Challenge
Car
s are Objects that have a color
and speed
. The color
is a String which is set when the car is created, and the speed is an int
which changes when the Car is accelerated. To accelerate a car by 1 unit, simply call its accelerate()
method.
Create a "green" car and accelerate it to a speed of 3.
Please sign in or sign up to submit answers.
Alternatively, you can try out Learneroo before signing up.