Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

I need to create a timer that stops at a certain number using java.?

For example, the timer needs to start at 0 and then count to 10 and then stop. Any help with the coding would be great!

1 Answer

Relevance
  • ?
    Lv 6
    1 decade ago
    Favorite Answer

    what should you do is multithreading

    Is it 10 seconds?

    public class Mine extends Thread

    {

    public void run()

    {

    try

    {

    sleep(1000);

    }

    catch(IllegealThreadState Exception e)

    {

    }

    }

    }

    now in the function where you want do like this

    Example ex=new Example();

    ex.start();

Still have questions? Get your answers by asking now.