class CustomThread extends Thread {
CustomThread() {}
CustomThread(final String threadname) {
setName(threadname);
}
@Override
public void run() {
while (true) {
System.out.println(Thread.currentThread().getName() + " executed,waiting for 1s");
try {
Thread.sleep(1000); // 1000 = 1s , so for 15 minutes insert the value 1000*60*15
}
catch (final InterruptedException ie) {}
}
}
}
public class MainThread {
public static void main(final String... args) {
System.out.println("main thread triggered");
System.out.println("custom threads triggered");
new CustomThread("thread 1").start();
//new CustomThread("thread 2").run();
System.out.println("main thread ended");
}
}