This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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: 9044
(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