i am making a little java project, it is my first and i just started of programming 2 days ago, i have pretty much no programming knowledge and i need some help with it. I am trying to add a sound into it, at the end, in a separate class, and i don't know how to perform this. (Sorry if my english is bad)
Here is my code:
import java.util.Scanner;
import java.awt.Toolkit;
public class Counter{
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
int n;
System.out.print("Type Starting number: ");
String sInput = scanner.nextLine();
int input = Integer.parseInt(sInput);
System.out.print("Type Ending number: ");
String aInput = scanner.nextLine();
int input2 = Integer.parseInt(aInput);
if (input <= input2) {
System.out.println("ERROR, invalid input, please try again");
main(args);
}
else {
for (n = input; n >= input2; n--)
{
try
{
Thread.sleep(1000);
}
catch(InterruptedException ex)
{
}
System.out.print(n + ", ");
};
Toolkit.getDefaultToolkit().beep();
try
{
Thread.sleep(1000);
}
catch(InterruptedException ex)
{
}
System.out.print("BOOM");
Toolkit.getDefaultToolkit().beep();
return;
}
}
}