Created
July 16, 2010 06:05
-
-
Save johobemax/478002 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 class MusicPlayerTest | |
{ | |
public static void main(String[] args) | |
{ | |
MusicPlayer ply = new MusicPlayer(); | |
ply.music = "ドラえもんの歌"; | |
ply.volume = 10; | |
ply.play(); | |
ply.stop(); | |
ply.volumeChange(20); | |
} | |
} | |
class MusicPlayer | |
{ | |
String music; //曲名 | |
int volume; //音量 | |
void play() // 曲再生 | |
{ | |
System.out.println(music + "を再生します"); | |
} | |
void stop() // 曲停止 | |
{ | |
System.out.println(music + "を停止します"); | |
} | |
void volumeChange(int v) //音量を変更する | |
{ | |
volume = v; | |
System.out.println("音量を" + volume + "にしました。"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment