Last active
April 30, 2020 13:56
-
-
Save singhrahuldps/279e1dbef75fd792479e1278554d5bf4 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
// A Media Player IS A Device | |
public class MediaPlayer extends Device{ | |
boolean turnedOn; | |
// In absence of super() statement, java automatically adds one during compilation | |
public MediaPlayer() { | |
this.turnedOn = false; | |
} | |
@Override | |
void switchOn() { | |
System.out.println("Player turned On!"); | |
this.turnedOn = true; | |
} | |
@Override | |
void switchOff() { | |
System.out.println("Player turned Off!"); | |
this.turnedOn = false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment