Solved

Is there a simple way of implementing a timer feature in Java?

Posted on 2003-12-08
4
267 Views
Last Modified: 2010-03-31
I was wondering whehter I could implement a simple timer in java is such a way that I could use it like.

if (time > 5){
Print time out exceeded
end program}

Thanks
0
Comment
Question by:welsh_boy
  • 2
4 Comments
 

Accepted Solution

by:
blackwednesday earned 75 total points
ID: 9898592
You can use java.util.Timer to do something after a set delay, if that's what you want to do.
0
 
LVL 35

Assisted Solution

by:girionis
girionis earned 50 total points
ID: 9899143
 As suggested by blackwednesday a Timer would be the best choice. Take a look here: http://java.sun.com/docs/books/tutorial/essential/threads/timer.html for some examples of how to use them.
0
 

Author Comment

by:welsh_boy
ID: 9899368
Thanks for the quick response as always
0
 
LVL 35

Expert Comment

by:girionis
ID: 9899400
 Thank you. Glad we helped :)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
This video teaches viewers about errors in exception handling.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now