• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how does this code make beep sound

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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++)
System.out.print((char)7);
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 ]
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
(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.
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch, Naufal!
 
reply
    Bookmark Topic Watch Topic
  • New Topic