Java Notes


A beep sound can be use to indicate a warning or error. However, it is often better to give a warning dialog box with a description of the problem.

To Produce a Beep Sound

  1. You need to import the Toolkit class:
       import java.awt.Toolkit;
  2. Use this statment in your code:
This is not always a sufficient way to alert the user as there may not be sound on the user's computer (as in many student labs) or the sound may be turned down, etc.