import javax.sound.midi.*; public class Main { public void play() { try{ Sequencer newSequencer=MidiSystem.getSequencer(); System.out.println("We have got a sequencer"); } catch(MidiUnavailableException ex){ System.out.println("Bummer!"); } } public static void main(String[] args) { // TODO Auto-generated method stub Main test=new Main(); test.play(); } }
没有添加try/catch的时候“Sequencer newSequencer=MidiSystem.getSequencer();”这行代码出现了异常,添加以后输出结果不应该是“Bummer!”吗?为什么是“We have got a sequencer”?
Caballarii
慕粉3681430
相关分类