Skip to content

Instantly share code, notes, and snippets.

@johobemax
Created July 16, 2010 06:05
Show Gist options
  • Save johobemax/478002 to your computer and use it in GitHub Desktop.
Save johobemax/478002 to your computer and use it in GitHub Desktop.
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