Bell character is the control code used to sound an audible bell or tone in order to alert the user (ASCII 7, EBCDIC 2F). Bell character is an ASCII control character, code 7 (^G). When it is sent to a printer or a terminal, nothing is printed, but an audible signal is emitted instead.

You can emit a beep by printing the ASCII Bell character ("\0007") to the console.

 public class testBeep {
  public static main(String args[]) {
     // ASCII bell