Results 1 to 3 of 3
Thread: Make Java Pause
- 02-09-2010, 05:43 PM #1
Senior Member
- Join Date
- Feb 2010
- Posts
- 128
- Rep Power
- 0
Make Java Pause
Hey all. I am not sure how "advanced" my question is, so I apologise the admins if this thread should be in the Advanced section.
Anyway. I have a robot and its runs Javelin micro controller, so I program my robot in Java. I am running this simple code:
Anyway, I would like to know if there is such way to pause the code for half a second or something like that?Java Code:for (int i=0;i<10;i++) System.out.println(i);
ThanksMeasuring programming progress by lines of code is like measuring aircraft building progress by weight.
- 02-09-2010, 05:47 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,601
- Blog Entries
- 7
- Rep Power
- 17
Read about the static method Thread.sleep( ... ).
kind regards,
Jos
- 02-10-2010, 10:18 AM #3
hi FlyNn,
i guess blew code can help you. good luck:
Java Code:public class TheThread { public static void main(String[] args) { for (int i=0;i<10;i++){ System.out.println(i); try { Thread.sleep(500); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }i hold 7 years develop exp. now i start a thread to share my knowlege about a j2ee project. welcome to participate.Study Java Through Real Java Project
Similar Threads
-
Pause and Continue Long Cycles
By pedro123 in forum Threads and SynchronizationReplies: 2Last Post: 07-28-2009, 07:47 AM -
How to stop/pause running third party exe?
By 2bGeek in forum AWT / SwingReplies: 3Last Post: 02-28-2009, 07:26 AM -
Cannot Implement Stop And Pause...multiple Actionlisteners..please Help.
By pkumar85 in forum Advanced JavaReplies: 1Last Post: 12-07-2008, 05:50 PM -
pause until JFrame is closed.
By Tamu in forum Advanced JavaReplies: 8Last Post: 11-30-2008, 09:46 PM -
Help with Pause
By trill in forum Java AppletsReplies: 2Last Post: 09-28-2007, 08:50 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks