JAVA作业音乐这个方面出错 代码如图

你那URL获取的方式参照一下这个代码

import java.applet.Applet; //导入方法依赖的package包/类
private static void playApplet(String filename) {
    URL url = null;
    try {
        File file = new File(filename);
        if (file.canRead())
            url = file.toURI().toURL();
    } catch (MalformedURLException e) {
        throw new IllegalArgumentException("could not play '" + filename + "'", e);
    }

    // URL url = StdAudio.class.getResource(filename);
    if (url == null) {
        throw new IllegalArgumentException("could not play '" + filename + "'");
    }

    AudioClip clip = Applet.newAudioClip(url);
    clip.play();
}