dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: Java
Expertise: Intermediate
Apr 10, 2007

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Emitting a Beep in Java

There are three ways to emit a beep in Java:
  1. Use an AU audio file: In Java, AU files need to be created at a sample rate of 8000. Higher sample rates will not work.
  2. Print the ASCII Bell character to the console, like this:
    
     public class testBeep {
      public static main(String args[]) {
         // ASCII bell
         System.out.print("\0007");
         System.out.flush();
         }
      }
    
  3. Starting with JDK 1.1, use the beep method in the Toolkit:
    
    import java.awt.*;
    public class beep {
      public static void main(String args[]) {
         Toolkit.getDefaultToolkit().beep();
         }
      }
    
Satish Kumar Pulavarthy
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date