Infinite Loop and System.exit(0) in java -


i wondering if bad coding practice and/or consequences if make infinite loop(i checking if program has started) , when condition im checking becomes true, use system.exit.

you may better off using java.util.timer , java.util.timertask classes, , recursively relaunching timer expires. above post says there nothing inherently wrong using system.exit.

public static void main(string[] args){     timer timer = new timer(); //create new timer     timer.schedule(new taskloop(), 1000); //schedule task 1000ms (1 sec) } class taskloop extends timertask {     public void run() {         system.out.println("here"); //timer's up, whatever need         timer timer = new timer();         timer.schedule(new taskloop(), 1000); //start timer.     } } 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -