File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes how does this code make beep sound Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how does this code make beep sound" Watch "how does this code make beep sound" New topic

how does this code make beep sound

Naufal Mohamed

Joined: Jan 14, 2003
Posts: 5
hi everybody
i'm new to this forum and a novice for java.
i'm delighted about this forum where beginners like me can clarify even a simple problem in java.
hope that i too get the fullest support from you guys.thank you
heres my problem:
for (i=0; i<10; i++)
above for loop makes the computer to beep.
how does this happen? is this a standard method to
make the computer beep?
[ January 14, 2003: Message edited by: Naufal Mohamed ]
Marilyn de Queiroz

Joined: Jul 22, 2000
Posts: 9058
(char)7 is equal to Ascii 0007 which is a control character. Letters/numbers don't begin until Ascii 28 or so. Control characters do special things. Form feed, carriage return, line feed, bell (which is the one you've discovered), and more. Most people don't use computer beeps anymore. Since speakers have come into more common usage, they use .wav files instead to get your attention.

"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
Welcome to JavaRanch, Naufal!

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
I agree. Here's the link:
subject: how does this code make beep sound
It's not a secret anymore!