Created
January 12, 2021 16:36
-
-
Save NitinPraksash9911/b1d343d073d5303769e149111562139d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface Car { | |
void turnOnEngine(); | |
void accelerate(); | |
} | |
public class MotorCar implements Car { | |
private Engine engine; | |
public void turnOnEngine() { | |
//turn on the engine! | |
engine.on(); | |
} | |
public void accelerate() { | |
//move forward! | |
engine.powerOn(1000); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment