0
Can you give me a function in java can play a sound from the library of the system?
2 Réponses
+ 3
I doubt there's any under the System library.
You could use javax or java.io.
You can also use the start() method to play the audio, in the Clip class. (You would first need to open it to some inputStream)
Some different versions/code(examples) here:
https://stackoverflow.com/questions/26305/how-can-i-play-sound-in-java
Clip:
https://docs.oracle.com/javase/7/docs/api/javax/sound/sampled/Clip.html
+ 2
if you want to play a beep from the motherboard buzzer print the ASCII bell charachter.
On SL Code Playground will probably beep the server in the server room(if it is equipped with a buzzer).
System.out.print("\007");