java - How to execute a block of code with 1 second intervals? -


i need execute block every 1 second, needs in same thread. means, understand, can't make use of timer class.

is there way want?

create thread , write loop -

while(true) {     //     thread.sleep(1000); } 

Comments