具体就是通过Java写一段代码,运行之后让电脑发出报警声音,不管是通过主机箱还是喇叭都行,求一个完整代码?

解决方案 »

  1.   

    主机箱的话似乎是: Toolkit.getDefaultToolkit().beep(); 不过笔记本是没用的。
      

  2.   

    这个我试过了,没反应,好像说是要在控制面板中设置什么,不过没看明白
    (Windows) The sound used is determined from the setting found in Control Panel/Sounds and Devices/Sounds/Sound Scheme/"Default Beep". If no sound file is selected then the beep() will be a silence.
      

  3.   

    循环调用并不额外消耗内存啊for (int i = 0;i<100;i++) {
      Toolkit.getDefaultToolkit().beep();
      Thread.sleep(500);
    }