Solved

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

Posted on 2003-12-08
4
255 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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 …
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
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 …

708 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

17 Experts available now in Live!

Get 1:1 Help Now