-1

Eclipse 抛出错误:

"MidiSystem.getSequencer cannot be resolved to a type"

我在跑步JavaSE- 1.7 with compliance level 1.7

不知道这里发生了什么

import javax.sound.midi.*;
public class drumKit{

    public void play(){
        try{
            Sequencer sequencer = new MidiSystem.getSequencer();
            System.out.println("got it");
        }
        catch(MidiUnavailableException ex){
            System.out.println("Cannot find");
        }
   }

    public static void main(String[] args){
        drumKit d = new drumKit();
        d.play();
   }
}
4

1 回答 1

0

getSequencer() 是静态方法,不需要使用new关键字

public void play(){
    try{
        Sequencer sequencer = MidiSystem.getSequencer();
        System.out.println("got it");
    }
于 2015-02-03T06:06:12.087 回答