Solved

Insert the Missing Code in the Following Code Fragment

Question 15

Multiple Choice

Insert the missing code in the following code fragment. This fragment is intended to initialize an instance variable.
Public class Motor
{
Int motorSpeed;
Public Motor(int speed)
{
MotorSpeed = speed;
}
Public Motor()
{
_________;
}
}
Which of the following lines of code will allow the second constructor to call the first constructor?


A) this.motorspeed(0) ;
B) this(0) ;
C) this(speed) ;
D) You cannot call a constructor from within another constructor.

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions