Results 1 to 5 of 5
- 07-22-2011, 09:34 AM #1
Banned
- Join Date
- Feb 2011
- Posts
- 65
- Rep Power
- 0
how to execute a code after the endless loops?
hello guys i ask this because im doing this.
i create a dos app and it runs on start up application then every time my computer runs i record the current time and date on text file.
then my big problem is i cant record the current time and date if i turn off my computer
see my code i hope some one can help me and thanks
Java Code:public class Main { public static void main(String[]args){ // i will record the current time in textfile every time i turn on my computer using filewriter while(true){ //this is endless loops } //then if my computer turn of i will record the current time in textfile //the problem is i cant execute my code on exit. // how to execute a code after the endless loops? } }
- 07-22-2011, 02:50 PM #2cant record the current time and date if i turn off my computer
- 07-24-2011, 03:57 AM #3
Banned
- Join Date
- Feb 2011
- Posts
- 65
- Rep Power
- 0
Are you asking if there is a way for the OS to tell your code that the computer is being turned off?
my be Yes..
is their any way to do that?
if No
how to execute a code after endless loops.
(i mean how to execute a code if i turn of my application)?
-
Perhaps you want to intermittently write the time to a file, and then the last time written should be close to the time that the computer was turned off.
- 07-24-2011, 05:21 AM #5
Banned
- Join Date
- Feb 2011
- Posts
- 65
- Rep Power
- 0
Similar Threads
-
[Semi-Beginner] (nested loops) What's wrong with my code? (nested loops)
By Solarsonic in forum New To JavaReplies: 20Last Post: 03-22-2011, 05:02 AM -
Unable to execute my code can u plz help me out
By Gayathri12 in forum New To JavaReplies: 6Last Post: 07-21-2010, 09:28 AM -
Execute code from ActionListener
By Viola in forum New To JavaReplies: 3Last Post: 05-29-2010, 06:10 PM -
Compile/Execute code in Java app
By Doctor Cactus in forum New To JavaReplies: 5Last Post: 12-16-2008, 10:58 AM -
error stack when I try to execute my code
By paty in forum New To JavaReplies: 1Last Post: 08-02-2007, 09:32 PM
Bookmarks