異常なエラーが発生します:-'void'タイプはここでは許可されていません
import javax.sound.midi.*;
public class MiniMusicPlayer1 {
public static void main(String[] args) {
try {
Sequencer player = MidiSystem.getSequencer();
Sequence seq = new Sequence(Sequence.PPQ, 4);
Track track = seq.createTrack();
for (int i = 5; i < 61; i += 4) {
track.add(makeEvent(144, 1, i, 100, i));
track.add(makeEvent(128, 1, i, 100, i));
}
player.setSequence(seq);
player.setTempoInBPM(220);
player.start();
} catch (Exception ex) {
System.out.println(ex.printStackTrace());
}
}
public static MidiEvent makeEvent(int comd, int ch, int note, int vel,
int tick) {
MidiEvent event = null;
try
{
ShortMessage a = new ShortMessage();
a.setMessage(comd, ch, note, vel);
event = new MidiEvent(a,tick);
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
return event;
}
ankit @ batchstar:/ home / mount_150 / Java $ javac MiniMusicPlayer1.java MiniMusicPlayer1.java:21:エラー:「void」タイプはここでは許可されていませんSystem.out.println(ex.printStackTrace()); ^
助けてください。