Solved

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

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Java - Why doesn't this JFrame work 3 58
nextBoolean(double p) for Random class 3 40
runtime exception 2 27
Java string replace 11 43
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

786 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