Java Java Objects Harnessing the Power of Objects Overload Methods

On Object, how do I call a new method called drive that pass and int of 1 by default?

Do I assign assign drive = 1 in the new method body?

1 Answer

Emmanuel C
Emmanuel C
8,732 Points

Hey Biswas,

Once youve updated the drive method to take a parameter of how many laps should be driven, like so ...

public void drive(int laps) {
    lapsDriven += laps;
    barCount -= laps;

It asked to create another method called drive with no parameters, but it calls the drive method with the parameter and has a 1 passed in. So...

public void drive(){