java学习类制作mplayer

class MediaPlayer{
    public String musicFile;
    public int soundLevel;
    public boolean isPlaying;
    public  void play(String file){
       // musicFile=file;
        System.out.println("开始播放:" + file);
    }
    public void pause(){
        System.out.println("暂停播放:" + musicFile);
    }
    public void level(){
        System.out.println("当前音量为:" + soundLevel);
    }
}
public class Class1_text {
    public static void main(String[] args) {
        MediaPlayer mplayer = new MediaPlayer();
        mplayer.musicFile = "class1.mp3";
        mplayer.soundLevel = 50;
        mplayer.isPlaying = true;
        mplayer.play("class1.mp3");
        mplayer.pause();
        mplayer.level();
    }
}
Last modification:September 19th, 2019 at 11:19 pm

Leave a Comment