Challenge for Constructor Code

Challenge

In a previous challenge, you created a Car using a Class that already had a constructor. In this challenge, do the reverse: create 2 constructors for the Car class.

The first constructor should take one String parameter and assign its value to the color variable.

The second constructor should take in two parameters, a String and a boolean. It should assign the String to color, and the boolean to the sunroof variable.

Please sign in or sign up to submit answers.

Alternatively, you can try out Learneroo before signing up.

Contact Us
Sign in or email us at [email protected]