With JFugue, you can make music in your Java program, and it's as easy as this:
Player player = new Player();
player.play("C D E F G A B");
JFugue supports a bunch of additional features, including musical patterns, rhythms, elements of music theory (including chords and chord progressions), and so much more.
For more details, please see http://www.JFugue.org