Challenge 2: Calling a Constructor from a Constructor

Can you call a constructor from another constructor? A solution is placed in the "solution" section to help you, but we would suggest you try to solve it on your own first.

Problem Statement

A class can have multiple parameterized constructors which can call each other.

You are given a partially completed code of a Car class in the editor. Modify the parametrized constructor which assigns parameters to the required fields.


carName, carModel, carCapacity


carName, carModel, carCapacity

Sample Input

                  "Ferrari", "F8", "100"

Sample Output

                  "Ferrari", "F8", "100" 

Get hands-on with 1200+ tech skills courses.