class P extends Thread {
@Override
public void run() {
try {
for (int i = 1; i <= 5; i++) {
System.out.println("akhil");
Thread.sleep(1000);
}
} catch (InterruptedException e) {
// Exception handling code (empty in this case)
}
}
}
class D {
public static void main(String[] args) throws InterruptedException {
P r = new P();
r.start(); // Starts the thread
for (int i = 1; i <= 5; i++) {
System.out.println("tanishq");
Thread.sleep(1000);
}
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter