How To Make Beeb Sound On Each Word In Java

How To Make Beeb Sound On Each Word In Java
hello guys , so you all know what is a beeb sound so on in vb.net or c-sharp it's veru easy to make beeb sound.

if you want to make beeb sound in vb.net here is the code
 Microsoft.VisualBasic.Interaction.Beep()

if you want to make beeb sound in c# here is the code

using Microsoft.VisualBasic;
using System.Media;

SystemSounds.Beep.Play();

ok now let's turn to java side

here is the codes that i wrote to do this , i am using arrays and a for loop and a thread.

actually i had to write this for a homework.



/*
Author : Mohamed Shimran
Blog : http://www.ultimateprogrammingtutorials.blogspot.com
*/
public class Beeb_Play{

    public static void main(String[] args) {

  System.out.println("BEEEEEEEEEEEEB!");

  String[] Beeb_Words = new String[]{"Ultimate ", "Programming ", "Tutorials "};

  int[] pause_0 = new int[]{300, 150, 150};

  for (int i = 0; i < pause_0.length; i++) {


java.awt.Toolkit.getDefaultToolkit().beep();

System.out.print(Beeb_Words[i]);

System.out.flush();


try {

    Thread.sleep(pause_0[i]);

} catch (Exception e) {

}

  }
    }
}


it will print out Ultimate programming tutorials on console and it will beeb for each word of the three words you can also add more cells in int array and add more word to string array.

enjoy the code .

Post a Comment

Note: Only a member of this blog may post a comment.