Solved

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

Posted on 2003-12-08
4
298 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

729 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