Skip to content

Instantly share code, notes, and snippets.

@neer2808
Created October 30, 2020 09:48
Show Gist options
  • Save neer2808/7a2edba2c81a1313db5450f82644103f to your computer and use it in GitHub Desktop.
Save neer2808/7a2edba2c81a1313db5450f82644103f to your computer and use it in GitHub Desktop.
class MyThread10 extends Thread
{
public void run() {
for (int i = 0; i < 10; i++) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("myThread10");
}
}
}
public class ThreadDemo4 {
public static void main(String[] args) {
MyThread10 obj = new MyThread10();
obj.start();
for (int i = 0; i <10 ; i++) {
System.out.println("inside the main thread");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment