我已经尝试了很多方法来让声音在Java中发挥但没有效果。这就是我上次尝试的内容:
import javax.sound.sampled.*;
public class Sound {
public Clip load(String filename) {
Clip clip = null;
try {
AudioInputStream audioIn = AudioSystem.getAudioInputStream(getClass().getResource(filename));
clip = AudioSystem.getClip();
clip.open(audioIn);
} catch (Exception e) { e.printStackTrace(); }
return clip;
}
}