Skip to content

Instantly share code, notes, and snippets.

@ellehallal
Last active May 29, 2019 07:25
Show Gist options
  • Save ellehallal/5b14d671de3d3dc71c4186ba8e8746c0 to your computer and use it in GitHub Desktop.
Save ellehallal/5b14d671de3d3dc71c4186ba8e8746c0 to your computer and use it in GitHub Desktop.
public class VideoPlayer implements MediaPlayer{
private String videoName;
private boolean isPlaying = false;
public VideoPlayer(String videoName) {
this.videoName = videoName
}
@Override
public void play() {
System.out.println("Playing...");
isPlaying = true;
}
@Override
public void stop() {
System.out.println("Stopped");
isPlaying = false;
}
@Override
public void currentlyPlaying() {
if (isPlaying) {
System.out.println(videoName + " is currently playing.");
}
else {
System.out.println(videoName + "is not playing. Press play");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment